listbox recno() display

Post Reply
brewster
Posts: 43
Joined: Wed Jun 20, 2012 4:07 am

listbox recno() display

Post by brewster »

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
brewster
Posts: 43
Joined: Wed Jun 20, 2012 4:07 am

Re: listbox recno() display

Post by brewster »

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
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: listbox recno() display

Post by MarcoBoschi »

Bruce,
try this

Code: Select all

#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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: listbox recno() display

Post by Enrico Maria Giordano »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: listbox recno() display

Post by Enrico Maria Giordano »

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
brewster
Posts: 43
Joined: Wed Jun 20, 2012 4:07 am

Re: listbox recno() display

Post by brewster »

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
Post Reply