FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TwBrowse question
Posts: 115
Joined: Mon Oct 17, 2005 04:42 AM
TwBrowse question
Posted: Mon Apr 02, 2007 12:01 PM

Dear All,

I am normally using TwBrowse Listbox with normal syntax of REDEFINE LISTBOX.... But in a typical situation, I want to assign columns to the listbox programmatically. I saw that it is being passed as second parameter as Code block. My data is in an array and I want to pass all the columns as field for the listbox.
e.g. {|| { oReport:ArrData[nItem,1],oReport:ArrData[nItem,2] } }

How can I assing columns in the code block in a loop ?

I hope somebody understand my problem and give some suggestion. I have difficulty in explaining my problem.

With best regards,

Milan.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TwBrowse question
Posted: Mon Apr 02, 2007 12:24 PM

Milan,

Just call a function from the codeblock, and in the function do whatever you may need:

{ || MyFunction() }

...

function MyFunction()

local aValues

// Build aValues the way you need it

return aValues

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 115
Joined: Mon Oct 17, 2005 04:42 AM
TwBrowse question
Posted: Mon Apr 02, 2007 02:49 PM

Dear Antonio,

My following code do not give desired result :

nItem := 1
REDEFINE LISTBOX oBrw FIELDS RetRecord(oReport:ArrData, nItem) ;
COLSIZES 50, 80;
HEADERS 'Code', 'Name';
FONT oFont ;
UPDATE ;
ID LBREPORT OF oDlg
............

FUNCTION RetRecord(aArrData, nItem)
LOCAL i, aRetVal := {}
FOR i = 1 TO len(aArrData[nItem])
AADD (aArrData, aArrData[nItem, i])
NEXT

RETURN aRetVal

What am I doing wrong ?

TIA
Milan.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TwBrowse question
Posted: Mon Apr 02, 2007 04:34 PM

Try this:

REDEFINE LISTBOX oBrw FIELDS "", "" ;
...

oBrw:bLine = { || RetRecord(oReport:ArrData, nItem) }

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion