TwBrowse question

Post Reply
Milan Mehta
Posts: 115
Joined: Mon Oct 17, 2005 4:42 am
Location: India

TwBrowse question

Post by Milan Mehta »

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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
Milan Mehta
Posts: 115
Joined: Mon Oct 17, 2005 4:42 am
Location: India

Post by Milan Mehta »

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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Try this:

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

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

Antonio Linares
www.fivetechsoft.com
Post Reply