FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour listbox recno() display
Posts: 43
Joined: Wed Jun 20, 2012 04:07 AM
listbox recno() display
Posted: Fri Dec 14, 2012 08:55 PM

Hello,

I am trying to implement a recno() indicator for the listbox code below.
By moving the row selection up or down it would display the related .dbf recno() in the dialog.
I gather some sort of bSkip mechanism is required.
I do not know the proper coding / syntax to accomplish the task.

@ 1, 1 LISTBOX oLbx ;
FIELDS TM->Shp_dte, TM->org, TM->DrpA, TM->DrpB ,;
TM->DrpC, TM->DrpD, TM->Drvr, TM->Notes ;
HEADERS "Ship Date", "Orgin", "A", "B", "C", "D", "DR","Notes" ;
FIELDSIZES 60, 45, 45, 45, 45, 45 , 40, 50 ;
SIZE 284, 137 OF oDlg

// possible ??
// space(5)+ {|nRecs|,dbskipper()}
//trans(oTmd:recno(),'99,999') +;
// ' / '+trans(oTmd:lastrec(),'99,999') OF oDlg

// possible

//{|nRecs|,oLbx:keyno() }

Any help, much appreciated.

Bruce S.

FW 6/12
Harbour v3.1 Rev 17222
ilink32 6.21

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: listbox recno() display
Posted: Sat Dec 15, 2012 09:41 PM

Try using ON CHANGE clause.

EMG

Posts: 43
Joined: Wed Jun 20, 2012 04:07 AM
Re: listbox recno() display
Posted: Sun Dec 16, 2012 02:57 PM

Enrico,
Thanks for your reply.
I need a little bit more.

So I try :

local nRecno
local bSkip

use TMD alias TM
//database oTm not using database statement, just the alias

@ 1, 1 LISTBOX oLbx ;
FIELDS TM->Shp_dte, TM->org, TM->DrpA, TM->DrpB ,;
TM->DrpC, TM->DrpD, TM->Drvr, TM->Notes ;
HEADERS "Ship Date", "Orgin", "A", "B", "C", "D", "DR","Notes" ;
FIELDSIZES 60, 45, 45, 45, 45, 45 , 40, 50 ;
ON CHANGE ( have tried all the syntax below and more ) ;
SIZE 284, 137 OF oDlg

 //ON CHANGE  oLbx:bSkip:= {|nRecno| , (dbskipper(TM->recno() ) ) }  ;
 //ON CHANGE  {|nRecno|, oLbx:recno() }  ;
 //ON CHANGE   oLbx: {|nRecno|, TM->recno() }  ;

frustration is just clouding it up now

an actual ON CHANGE statement with proper syntax wold be greatly appreciated

Thanks,
Bruce

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: listbox recno() display
Posted: Sun Dec 16, 2012 03:17 PM
Bruce,
try this

Code (fw): Select all Collapse
#include "fivewin.ch"
FUNCTION MAIN
local oDlg
local oLbx


use customer

DEFINE DIALOG oDlg FROM 0 , 0 TO 300 , 300  PIXEL

@ 1, 1 LISTBOX oLbx ;
FIELDS field->first, field->last , STR(recno(),4) ;
HEADERS "First", "Last", "Recno"  ;
FIELDSIZES 40 , 40 , 40  OF oDlg  SIZE 150 , 150

ACTIVATE DIALOG oDlg CENTER

RETURN  NIL


If You substitute STR(recno(),4) With recno() You do not see record number but empty column
Do not ask me WHY!

bye now
marco
Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: listbox recno() display
Posted: Sun Dec 16, 2012 03:24 PM

Bruce,

if you want to show the record number in a column then follow Marco's advice. If you want to show the record number in a GET while moving the record pointer then use something like

... GET oGet Var cVar

...

ON CHANGE ( cVar := LTRIM( STR( RECNO() ) ), oGet:Refresh() )

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: listbox recno() display
Posted: Sun Dec 16, 2012 03:27 PM
MarcoBoschi wrote:If You substitute STR(recno(),4) With recno() You do not see record number but empty column
Do not ask me WHY!


Because TWBrowse takes data numbers as bitmaps handles. That's how it displays bitmaps inside its cells.

EMG
Posts: 43
Joined: Wed Jun 20, 2012 04:07 AM
Re: listbox recno() display
Posted: Sun Dec 16, 2012 07:13 PM

Marco / Enrico ,

 Thanks for your tips/advice. I got it working.

One final question.

Within the dialog I'm using for this listbox, I have - Search, OK, and Cancel buttons.

When returning from the search function(), I have to click on the data portion of the listbox to get its "focus" back
to a highlighted data record.

I gather there is a FW setfocus function(), when coming out of my search function(), it would automatically return to the
highlighted record.

Many thanks,
Bruce

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: listbox recno() display
Posted: Sun Dec 16, 2012 07:15 PM

As simple as oBrw:SetFocus(). :-)

EMG

Continue the discussion