XBrowse and Array?

Post Reply
Horizon
Posts: 1323
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 4 times

XBrowse and Array?

Post by Horizon »

Hi,

My sample is below. I want to print "Apple","Orange","Banana","Pear" instead of 1,2,3,4 at 6. column.

Is there any solution?

Thanks,

Code: Select all | Expand

#include "FiveWin.Ch"
#include "xbrowse.ch"
//------------------------------------------------------------------//

function Main()

   local aData := { ;
     { 1, 'One', 45, date(), 23456, 1 }, ;
     { 2, 'Two', 2222, date()-1, 345, 2 } , ;
     { 3, 'Three', 3333, date()-2, 789, 3 }, ;
     { 4, 'Four', 4444, date()-3, 234, 4 } }
   local oDlg, oBrw
   local aType := {"Apple","Orange","Banana","Pear"}

   DEFINE DIALOG oDlg SIZE 440,240 PIXEL
   @ 10,10 XBROWSE oBrw SIZE 200,100 PIXEL OF oDlg ;
      COLUMNS 1, 2, 3, 4, 5, 6 ;
      HEADERS 'No', 'Description', 'Number', 'Date', 'Number-2', 'Type' ;
      ARRAY aData ;
      ON DBLCLICK MsgInfo( 'ok' ) ;
      MESSAGE 'my message'

   WITH OBJECT oBrw
      :lHScroll         := .F.
      :nMarqueeStyle    := MARQSTYLE_HIGHLROW
      :nColDividerStyle := LINESTYLE_RAISED
      :nRowDividerStyle := LINESTYLE_RAISED
      :nStretchCol      := STRETCHCOL_WIDEST
      :CreateFromCode()
   END
   
   if ! Empty( oCol := oBrw:oCol( "Type" ) )
//      oCol:bStrData := {|o| ?????????
   endif

   ACTIVATE DIALOG oDlg CENTERED

return ( 0 )
 
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: XBrowse and Array?

Post by nageswaragunupudi »

Code: Select all | Expand


oBrw:oCol( 'Type' ):bEditValue   := { || aType[ oBrw:aRow[ 6 ] ] }
 

This should be before oBrw:CreateFromCode()
Note: FWH advises not to use bStrData and instead to use bEditValue
Regards

G. N. Rao.
Hyderabad, India
Post Reply