Does xBrowse work on a one dimensional array.
Regards,
Otto
#include "fivewin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oBrw
local aList := { "One..", "Two..", "Three", "Four.", "Five." }
DEFINE WINDOW oWnd
@ 0,0 XBROWSE oBrw ARRAY aList OF oWnd
ADD TO oBrw DATA oBrw:aRow HEADER 'Item'
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
return nil
/*
otherways of writing the above code.
ADD TO oBrw DATA aList[ oBrw:nArrayAt ] HEADER "item"
or
oCol := oBrw:AddCol()
oCol:bStrData := { || aList[ oBrw:nArrayAt ] }
But I prefer to write the shortest code as above. XBrowse pampers my laziness.
*/
METHOD SetArray( ........... )
<< FWH code >>
::aCols := {} // after this is FWH code
if ValType( aData[ 1 ] ) == 'A' // insert this line here
// fwh code continues
for nFor := 1 to len( aData[ 1 ] )
oCol := ::AddCol()
<< FWH code >>
next
// after this FWH code,
endif // insert this line here
<< fwh code continues >>
oBrw := TXBrowse():New( oChild )
oBrw:SetArray( ADEVICES )
oCol := oBrw:AddCol()
oCol:bStrData := { || ADEVICES[ oBrw:nArrayAt ] }
#include 'fivewin.ch'
#include 'xbrowse.ch'
function main()
local oDlg, oBrw
local aData := { 'one ', 'two ', 'three', 20, DATE() }
DEFINE DIALOG oDlg SIZE 200,200 PIXEL
oBrw := TXBrowse():New( oDlg )
oBrw:SetArray( aData )
oBrw:aCols[ 1 ]:nWidth := 50
oBrw:aCols[ 1 ]:cHeader := 'Array'
oBrw:nStretchCol := 1
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 79 guests