FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Listbox Help
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Listbox Help
Posted: Tue Jun 27, 2006 06: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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Listbox Help
Posted: Tue Jun 27, 2006 09: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Listbox Help
Posted: Wed Jun 28, 2006 08: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
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Listbox Help
Posted: Thu Sep 14, 2006 02: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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Listbox Help
Posted: Thu Sep 14, 2006 04:47 PM

You have to assign oLbx:bLogicLen too.

EMG

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Listbox Help
Posted: Thu Sep 14, 2006 05: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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Listbox Help
Posted: Thu Sep 14, 2006 05:49 PM

Jeff,

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

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Listbox Help
Posted: Thu Sep 14, 2006 06: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> ]

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Listbox Help
Posted: Thu Sep 14, 2006 07:16 PM

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

EMG

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Listbox Help
Posted: Thu Sep 14, 2006 07:57 PM

Thanks guys.

It works perfectly now.

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion