Page 1 of 1
listbox recno() display
Posted: Fri Dec 14, 2012 8:55 pm
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
Re: listbox recno() display
Posted: Sat Dec 15, 2012 9:41 pm
by Enrico Maria Giordano
Try using ON CHANGE clause.
EMG
Re: listbox recno() display
Posted: Sun Dec 16, 2012 2:57 pm
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
Re: listbox recno() display
Posted: Sun Dec 16, 2012 3:17 pm
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
Re: listbox recno() display
Posted: Sun Dec 16, 2012 3:24 pm
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
Re: listbox recno() display
Posted: Sun Dec 16, 2012 3:27 pm
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
Re: listbox recno() display
Posted: Sun Dec 16, 2012 7:13 pm
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
Re: listbox recno() display
Posted: Sun Dec 16, 2012 7:15 pm
by Enrico Maria Giordano
As simple as oBrw:SetFocus().
EMG