Listbox Help

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Listbox Help

Post by Jeff Barnes »

Hi Everybody,

I'll try to explain this as best I can....

I have a listbox created from resource.
When the listbox is first created there is no database associated with it
(REDEFINE LISTBOX oLbx ID 131 of oDlg UPDATE)

When the user selects a database file drop a drop down list, I need to display 3 fields from this database.

I need to re-define the listbox with the new database.
I have tried doing a:

REDEFINE Listbox oLbx FIELDS RepData->Time, STR(RepData->Sat), STR(RepData->HR) ID 131 ;
FIELDSIZES 60,35,35 ;
HEAD "Time","SPO2","HR";
of oDlg UPDATE

but it gives me a duplicate ID error.

Any ideas to get around this problem?

Thanks in advance,

Jeff
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Post by Gale FORd »

Have you tried

oLbx := nil

REDEFINE Listbox oLbx FIELDS RepData->Time, STR(RepData->Sat), STR(RepData->HR) ID 131 ;
FIELDSIZES 60,35,35 ;
HEAD "Time","SPO2","HR";
of oDlg UPDATE
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Jeff,

Try to use three dummy fields since the beginning:

REDEFINE LISTBOX oLbx FIELDS "", "", "" ID 131 of oDlg UPDATE

and later on set its DATA bLine:

oLbx:bLine = { || { RepData->Time, STR(RepData->Sat), STR(RepData->HR) } }

(Please notice that it is a codeblock that returns an array)

and oLbx:Refresh()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

I am now back to this listbox issue....

I am using the following code to reload the listbox with new data:

oLbx:bLine := { || { RepData->Time, STR(RepData->Sat), STR(RepData->HR) } }

All I get in the listbox is the first entry in the database repeated 5 times.

Any Ideas?


Thanks,
Jeff
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Enrico,

I have added:

oLbx:bLogicLen = { || RecCount() }

Still get the first record repeated 5 times. Sample of code below.



Function LoadSat() //called from function that displays the listbox
use "\MyFile.dbf" SHARED ALIAS "RepData" NEW
Select RepData
Go Top
oLbx:bLine := { || { RepData->Time, STR(RepData->Sat), STR(RepData->HR) } }
oLbx:bLogicLen()
oLbx:ReFresh()
Return Nil


Any Ideas?

Jeff
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Jeff,

You have to use the ALIAS clause in the listbox definition.

James
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Now I'm lost ... I don't see any ALIAS clause in the help file. This is what I have in my help file....


REDEFINE LISTBOX [ <oLbx> VAR ] <cnVar> ;

[ ITEMS | PROMPTS <aItems> ] ;
[ FILES | FILESPEC <cFileSpec> ] ;
[ ID <nId> ] ;
[ ON CHANGE <uChange> ] ;
[ ON [ LEFT ] DBLCLICK <uLDblClick> ] ;
[ OF | WINDOW | DIALOG <oWnd> ] ;
[ HELPID | HELP ID <nHelpId> ] ;
[ BITMAPS [ SIZE <nSize> ] ] ;
[ VALID <uValid> ] ;
[ COLOR | COLORS <nClrFore> [,<nClrBack>] ] ;
[ MESSAGE <cMsg> ] ;
[ UPDATE ] ;
[ WHEN <uWhen> ]

[ BITMAPS <aBitmaps> ] ;
[ ON DRAWITEM <uBmpSelect> ]
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Please look in Fivewin.ch instead. It is the best documentation. :-)

EMG
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Thanks guys.

It works perfectly now.


Jeff
Post Reply