FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse and Array?
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
XBrowse and Array?
Posted: Wed Dec 16, 2009 11:14 PM
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 (fw): Select all Collapse
#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.06
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse and Array?
Posted: Thu Dec 17, 2009 01:41 AM
Code (fw): Select all Collapse
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

Continue the discussion