Article ID: 185242
Article Last Modified on 5/12/2003
****************************************************************
**** Top of Sample Code for ToolBar and Navigation Class ****
**** Tbnav.prg ****
** Define the toolbar class. **
DEFINE CLASS skipbar AS toolbar
Caption = "SkipBar"
Height = 40
Left = 0
Top = 0
Width = 181
Name = "skipbar"
oform = .F. && Will hold reference of calling object.
ADD OBJECT cmdprev AS commandbutton WITH ;
Top = 5, ;
Left = 5, ;
Height = 31, ;
Width = 86, ;
Caption = "Prev", ;
Name = "cmdPrev"
ADD OBJECT cmdnext AS commandbutton WITH ;
Top = 5, ;
Left = 90, ;
Height = 31, ;
Width = 86, ;
Caption = "Next", ;
Name = "cmdNext"
PROCEDURE Init
LPARAMETERS toForm && Get the calling objects reference.
THIS.oForm = toForm
ENDPROC
PROCEDURE cmdnext.Click
THIS.Parent.oForm.oNav.pNext() && Call pNext in Navigation.
THIS.Parent.oForm.Refresh()
ENDPROC
PROCEDURE cmdprev.Click
THIS.Parent.oForm.oNav.pPrev() && Call pPrev in Navigation.
THIS.Parent.oForm.Refresh()
ENDPROC
ENDDEFINE
** Define the custom navigation class. **
DEFINE CLASS navigation AS custom
Name = "navigation"
nskiptable = .F.
PROCEDURE pNext
SELECT (THIS.nSkipTable)
SKIP
IF EOF() THEN
SKIP -1
ENDIF
ENDPROC
PROCEDURE pPrev
SELECT (THIS.nSkipTable)
SKIP -1
IF BOF() THEN
SKIP
ENDIF
ENDPROC
PROCEDURE first
SELECT THIS.nSkipTable
GO TOP
ENDPROC
PROCEDURE last
SELECT THIS.nSkipTable
GO BOTTOM
ENDPROC
PROCEDURE Init
THIS.nSkipTable = SELECT(0)
ENDPROC
ENDDEFINE
**** Bottom of Sample Code for ToolBar and Navigation Class ****
****************************************************************
CREATE TABLE customer (cust_id c(5), contact c(5))
INSERT INTO customer VALUES ("AAAAA","A1A1A")
INSERT INTO customer VALUES ("BBBBB","B1B1B")
INSERT INTO customer VALUES ("CCCCC","C1C1C")
INSERT INTO customer VALUES ("DDDDD","D1D1D")
INSERT INTO customer VALUES ("EEEEE","E1E1E")
INSERT INTO customer VALUES ("FFFFF","F1F1F")
**Specify file that contains SkipBar and Navigation Class
Definitions
SET PROCEDURE TO Tbnav.prg
**Create SkipBar and pass current Forms reference to it.
**Creat SkipBar object, save reference to Form's oSkipBar property.
THIS.oSkipBar = CREATEOBJECT('SkipBar', THIS)
THIS.oSkipBar.Visible = .T.
**Creat Navigation object, save reference to Form's oSkipBar
property
THIS.oNav = CREATEOBJECT('navigation')tmpAC = THIS.Parent.oForm.ActiveControl tmpAC.Value = tmpAc.TextMake sure that the above two lines are the first two in the procedures.
Additional query words: vfoxwin
Keywords: kbprb KB185242