convert from oldest Listbox to xbrowse
- Silvio.Falconi
- Posts: 7154
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 2 times
convert from oldest Listbox to xbrowse
on old app I have a listbox have these commands
REDEFINE LISTBOX oBrd FIELDS (oDDom)->DomEnt HEADER "Domicilio" ;
ALIAS (oDDom)->(Alias()) ID 110 OF oDld
oBrd:bGoTop :={|| GoToTop(oDDom,cCli)}
oBrd:bGoBottom:={|| GoToBot(oDDom,cCli)}
oBrd:bSkip :={|n| MovePtr(oDDom,cCli,n)}
How I can converte ( the bold lines ) it into Xbrowse() ?
REDEFINE LISTBOX oBrd FIELDS (oDDom)->DomEnt HEADER "Domicilio" ;
ALIAS (oDDom)->(Alias()) ID 110 OF oDld
oBrd:bGoTop :={|| GoToTop(oDDom,cCli)}
oBrd:bGoBottom:={|| GoToBot(oDDom,cCli)}
oBrd:bSkip :={|n| MovePtr(oDDom,cCli,n)}
How I can converte ( the bold lines ) it into Xbrowse() ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: convert from oldest Listbox to xbrowse
Silvio,
METHODS in xBrowse
just change the codeblocks to :
oBrd:GoTop()
oBrd:GoBottom()
oBrd:Skip( n )
regards
Uwe
METHODS in xBrowse
just change the codeblocks to :
oBrd:GoTop()
oBrd:GoBottom()
oBrd:Skip( n )
regards
Uwe

Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Silvio.Falconi
- Posts: 7154
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 2 times
Re: convert from oldest Listbox to xbrowse
sorry but perhaps there is an error see cCli
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: convert from oldest Listbox to xbrowse
You must be using a modified version of TListbox.
I searched TListbox, TControl, and TWindow for the variable bGoTop and it doesn't exist.
What are the functions GoToTop(), GoToBot(), and MovePtr() supposed to do?
I searched TListbox, TControl, and TWindow for the variable bGoTop and it doesn't exist.
What are the functions GoToTop(), GoToBot(), and MovePtr() supposed to do?
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Silvio.Falconi
- Posts: 7154
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 2 times
Re: convert from oldest Listbox to xbrowse
WBROWSE OF HERNAN CECCARELLI Do you Know it ?
I have used this in the past in many applications before coming to the xbrowse
this source works well with Hernan's browse class (18/08/2004---Revision 17)
a part of oldest application
it use these lines
cCli is the account number of customer
oBrd:bGoTop :={|| GoToTop(oDDom,cCli)}
oBrd:bGoBottom:={|| GoToBot(oDDom,cCli)}
oBrd:bSkip :={|n| MovePtr(oDDom,cCli,n)}
I have used this in the past in many applications before coming to the xbrowse
this source works well with Hernan's browse class (18/08/2004---Revision 17)
a part of oldest application
Code: Select all | Expand
FUNCTION Otros_Dom(cCli)
LOCAL oDld, oBrd, oDDom , oDat[4]
LOCAL oBtn[5], lNew, lCap, aDat[4]
lNew:=lCap:=.F.
oDDom:=Open_Dbf("DomEnt")
(oDDom)->(DbSeek(cCli))
DEFINE DIALOG oDld RESOURCE "Dlg_Dom" FONT oWnd:oFont
REDEFINE LISTBOX oBrd FIELDS (oDDom)->DomEnt HEADER "Domicilio" ;
ALIAS (oDDom)->(Alias()) ID 110 OF oDld
oBrd:nClrForeHead:=CLR_BLUE
oBrd:bGoTop :={|| GoToTop(oDDom,cCli)}
oBrd:bGoBottom:={|| GoToBot(oDDom,cCli)}
oBrd:bSkip :={|n| MovePtr(oDDom,cCli,n)}
oBrd:bChange :={|| Refr_Dom(oDDom,oDat,aDat)}
REDEFINE GET oDat[1] VAR aDat[1] ID 201 OF oDld PICTURE "@!" WHEN lCap UPDATE VALID !Empty(aDat[1])
REDEFINE GET oDat[2] VAR aDat[2] ID 202 OF oDld PICTURE "@!" WHEN lCap UPDATE
REDEFINE GET oDat[3] VAR aDat[3] ID 203 OF oDld PICTURE "@!" WHEN lCap UPDATE
REDEFINE GET oDat[4] VAR aDat[4] ID 204 OF oDld PICTURE "@!" WHEN lCap UPDATE
REDEFINE BUTTON oBtn[1] ID 210 OF oDld ACTION RegD_Dom(.T.,lNew,oDat,aDat,oDDom,oBrd,@lCap,oBtn,cCli,oDld) WHEN lCap
REDEFINE BUTTON oBtn[2] ID 220 OF oDld ACTION RegD_Dom(.F.,lNew,oDat,aDat,oDDom,oBrd,@lCap,oBtn,cCli,oDld) CANCEL WHEN lCap
REDEFINE BUTTON oBtn[3] ID 120 OF oDld ACTION Edit_Dom(.T.,oDat,aDat,oDDom,oBrd,@lCap,@lNew,oBtn,oDld)
REDEFINE BUTTON oBtn[4] ID 130 OF oDld ACTION Borra_Dom(oDDom,oBrd,cCli)
REDEFINE BUTTON oBtn[5] ID 140 OF oDld ACTION Edit_Dom(.F.,oDat,aDat,oDDom,oBrd,@lCap,@lNew,oBtn,oDld)
ACTIVATE DIALOG oDld ;
ON INIT (oDat[1]:Hide(),oBtn[1]:Disable(),oBtn[2]:Disable());
VALID (Close_Dbf("DomEnt",oDDom),.T.)
RETURN (NIL)
it use these lines
cCli is the account number of customer
oBrd:bGoTop :={|| GoToTop(oDDom,cCli)}
oBrd:bGoBottom:={|| GoToBot(oDDom,cCli)}
oBrd:bSkip :={|n| MovePtr(oDDom,cCli,n)}
Code: Select all | Expand
FUNCTION GoToTop(cAlias,cKey)
DbSelectArea(cAlias)
(cAlias)->(DbSeek(cKey))
RETURN (NIL)
FUNCTION GoToBot(cAlias,cKey)
LOCAL cTem:=STUFF(cKey,Len(cKey),1,Chr(Asc(Right(cKey,1))+1))
DbSelectArea(cAlias)
(cAlias)->(DbSeek(cTem,.T.))
(cAlias)->(DbSkip(-1))
IF &((cAlias)->(IndexKey(0)))=cKey
(cAlias)->(DbSkip(0))
ELSE
(cAlias)->(DbSeek(cKey))
ENDIF
RETURN (NIL)
FUNCTION MovePtr(cAlias,cKey,nReg)
LOCAL nNext:=0
DbSelectArea(cAlias)
IF nReg=0 .OR. (cAlias)->(LastRec())=0 .OR. !(&((cAlias)->(IndexKey(0)))=cKey)
(cAlias)->(DbSkip(0))
ELSEIF nReg>0 .AND. (cAlias)->(RecNo())<>(cAlias)->(LastRec())+1
DO WHILE nNext<=nReg .AND. !(cAlias)->(EoF()) .AND. &((cAlias)->(IndexKey(0)))=cKey
(cAlias)->(DbSkip())
nNext++
ENDDO
(cAlias)->(DbSkip(-1))
nNext--
ELSEIF nReg<0
DO WHILE nNext>=nReg .AND. !(cAlias)->(BoF()) .AND. &((cAlias)->(IndexKey(0)))=cKey
(cAlias)->(DbSkip(-1))
nNext--
ENDDO
IF !(cAlias)->(BoF())
(cAlias)->(DbSkip())
ENDIF
nNext++
ENDIF
RETURN (nNext)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: convert from oldest Listbox to xbrowse
Silvio,
First set the index for the database object.
oClilents:setOrder("cli") // just an example
Then just do as Uwe says:
just change the codeblocks to :
oBrd:GoTop()
oBrd:GoBottom()
oBrd:Skip( n )
First set the index for the database object.
oClilents:setOrder("cli") // just an example
Then just do as Uwe says:
just change the codeblocks to :
oBrd:GoTop()
oBrd:GoBottom()
oBrd:Skip( n )
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Silvio.Falconi
- Posts: 7154
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 2 times
Re: convert from oldest Listbox to xbrowse
not run ok
perhaps only but I made only a test
oGuests:= TGuests():New()
oGuests:Seek(cCli)
oGuests:OrdScope(0,cCli)
oGuests:OrdScope(1,cCli)
@2, 2 XBROWSE oBrowse OF oDglGuests SIZE 170,60 PIXEL;
COLUMNS "Cognome","Nome","TipoOspite";
HEADERS "Surname","Name","Type";
COLSIZES 100,100,90 ;
CELL LINES NOBORDER ;
DATASOURCE oGuests
perhaps only but I made only a test
oGuests:= TGuests():New()
oGuests:Seek(cCli)
oGuests:OrdScope(0,cCli)
oGuests:OrdScope(1,cCli)
@2, 2 XBROWSE oBrowse OF oDglGuests SIZE 170,60 PIXEL;
COLUMNS "Cognome","Nome","TipoOspite";
HEADERS "Surname","Name","Type";
COLSIZES 100,100,90 ;
CELL LINES NOBORDER ;
DATASOURCE oGuests
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: convert from oldest Listbox to xbrowse
not run ok
That is not much help. Exactly what is not OK?
You don't need to do a seek, and you may have to do a gotop() after setting the scope.
And your original message was about gotop() and gobottom(), not about scopes.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Silvio.Falconi
- Posts: 7154
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 2 times
Re: convert from oldest Listbox to xbrowse
I tried with scope simulating that codeblocks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: convert from oldest Listbox to xbrowse
So what is not working?
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Silvio.Falconi
- Posts: 7154
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 2 times
Re: convert from oldest Listbox to xbrowse
seem run ok
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com