FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse and bitmap from resource
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
xbrowse and bitmap from resource
Posted: Mon Jan 03, 2011 03:19 PM

Hi all,
I need to display into an xbrowse the bitmaps contained (as hansle) in the first array element.

Having the following code:

b_red:=LoadBitmap(GetResources(),"RED")
b_green:=LoadBitmap(GetResources(),"GREEN")

aArray:={}
aadd(aArray,{b_red,"Marc"})
aadd(aArray,{b_green,"Paul"})

I tried with:

REDEFINE XBROWSE oBrw ARRAY aArray  ID 101 OF oDlg
 ADD COLUMN TO XBROWSE oBrw BITMAP DATA aArray[OBRW:NARRAYAT(),1] ;     // array element # 1
    HEADER "Status"  SIZE 20 CENTER
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2 ;     
    HEADER "Names"  SIZE 80

but the first column always appear blank.

Any ideas ? Thanks in advance.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xbrowse and bitmap from resource
Posted: Mon Jan 03, 2011 05:15 PM
To show bitmaps, it is not the right way to keep the bitmap handles in the array data.
You may please try
Code (fw): Select all Collapse
aArray := { 'Marc', 'Paul' }

REDFINE XBROWSE AUTOCOLS HEADERS "Names" ARRAY aArray ID 101 OF oDlg
// now oBrw shows 'Marc' and 'Paul' in column 1.
ADD TO oBrw AT 1 DATA oBrw:nArrayAt HEADER 'Status' BITMAP IN "RED","GREEN"
ACTIVATE DIALOG oDlg

Here is the pure oops style:
Code (fw): Select all Collapse
aArray := { { 1, 'Marc' }, { 2, 'Paul' } }

oBrw := TXBrows():New( oDlg )
oBrw:SetArray( aArray )
oBrw:cHeaders := { 'Status', 'Names' }
WITH OBJECT oBrw:aCols[ 1 ]
   :AddBitmap( { "RED", "GREEN" } )
   :bBmpData := { || oBrw:aArrayData[ oBrw:nArrayAt, 1 ] }
   :bStrData   := { || '' }
END
oBrw:CreateFromResource( 101 )
ACTIVATE DIALOG oDlg
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion