TwBrowse question

TwBrowse question

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

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

Postby Milan Mehta » Mon Apr 02, 2007 2: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.
Milan Mehta
 
Posts: 115
Joined: Mon Oct 17, 2005 4:42 am
Location: India

Postby Antonio Linares » Mon Apr 02, 2007 4:34 pm

Try this:

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

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests