Listbox Help

Listbox Help

Postby Jeff Barnes » Tue Jun 27, 2006 6:02 pm

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
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Gale FORd » Tue Jun 27, 2006 9:17 pm

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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Antonio Linares » Wed Jun 28, 2006 8:02 am

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

Postby Jeff Barnes » Thu Sep 14, 2006 2:47 pm

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: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Enrico Maria Giordano » Thu Sep 14, 2006 4:47 pm

You have to assign oLbx:bLogicLen too.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Thu Sep 14, 2006 5:31 pm

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
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby James Bott » Thu Sep 14, 2006 5:49 pm

Jeff,

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

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

Postby Jeff Barnes » Thu Sep 14, 2006 6:21 pm

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
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Enrico Maria Giordano » Thu Sep 14, 2006 7:16 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Thu Sep 14, 2006 7:57 pm

Thanks guys.

It works perfectly now.


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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests