xbrowse and bitmap from resource

xbrowse and bitmap from resource

Postby Marco Turco » Mon Jan 03, 2011 3: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: xbrowse and bitmap from resource

Postby nageswaragunupudi » Mon Jan 03, 2011 5: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: Select all  Expand view

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: Select all  Expand view


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
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 98 guests