Does xBrowse work on a one dimensional array.
Regards,
Otto
Does xBrowse work on a one dimensional array.
Regards,
Otto
No ![]()
Wish it works. Right ?
Hello NageswaraRao,
Thank you.
I tested the printer code from Richard and wanted to show the result in a Xbrowse.
http://forums.fivetechsoft.com/viewtopic.php?t=11640
But it didn’t work. I added a extra field and then all was ok.
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.
*/Hello NageswaraRao,
thank you for your help.
The dBase syntax is working perfectly but trying the other two ways you suggested I get an error.
ADDCOL no method ( I am not sure but I think I am still on FW 8.02)
And the first test errors out with argument error Len from errorsys, line 0.
Would you please be so kind to help me.
Thanks in advance
Otto
STATIC FUNCTION ShowPrinters( oWnd )
local oChild, oBrw, oCol
local ADEVICES := {}
local aStruc:={}
ADEVICES := GETIMPRI(ADEVICES)
DEFINE WINDOW oChild TITLE "DBF structrure without record selector" MDICHILD OF oWnd
oBrw := TXBrowse():New( oChild )
oBrw:SetArray( ADEVICES)
ADD TO oBrw DATA ADEVICES[ oBrw:nArrayAt ] HEADER "item"
// oCol := oBrw:AddCol()
// oCol:bStrData := { || ADEVICES[ oBrw:nArrayAt ] }
// @ 0,0 XBROWSE oBrw ARRAY ADEVICES OF oChild
// ADD TO oBrw DATA oBrw:aRow HEADER 'Item'
oBrw:CreateFromCode()
oChild:oClient := oBrw
ACTIVATE WINDOW oChild ON INIT oBrw:SetFocus()
RETURN NIL
//----------------------------------------------------------------------------//
FUNCTION GETIMPRI(ADEVICES)
*----------------------------------------
LOCAl cAllEntries, cEntry, I, cName, cPrn, cPort, J
cAllEntries := STRTRAN( GetProfString( "Devices" ), Chr( 0 ), CRLF )
FOR I:= 1 TO MlCount( cAllEntries )
cName := MemoLine( cAllEntries,,I)
cEntry := GetProfString( "Devices",cName,"")
J := 2
WHILE ! EMPTY(cPort := StrToken(cEntry,J++,","))
// AADD(aDevices,TRIM(cName))
AADD(aDevices,TRIM(cName) + "," + CENTRY ) // CHIDIAK
ENDDO
NEXT
RETURN aDevices
Mr Otto
>
oCol := oBrw:AddCol()
oCol:bStrData := { || ADEVICES[ oBrw:nArrayAt ] }
>
This syntax should work even with the oldest version of XBrowse. I can't think of any reason why it should not work for you. Will you please try again ?
I personally suggest you to use the latest version 8.05. Do you have any techinical problems in upgrading to 8.05 ?
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 ] }Thank you very much for your help.
Regards,
Otto
#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