Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TOP, Previous, Next and Bottom Button
Message
From
08/10/2001 11:29:56
Ashish Patel
Hindustan Petroleum
Mumbai, India
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
TOP, Previous, Next and Bottom Button
Miscellaneous
Thread ID:
00565520
Message ID:
00565520
Views:
57
I am having 4 buttons on each form viz. TOP,PREVIOUS, NEXT and BOTTOM.
I have created the following code on each buttons click event

"For TOP Button" : Click Event
----------------

sele Register
set order to tag Register
if not bof()
go top
endif
thisform.cmdPrev.Enabled = .f.
thisform.cmdTop.Enabled = .f.
thisform.cmdnext.Enabled = .t.
thisform.cmdbott.Enabled = .t.

if bof()
thisform.cmdPrev.Enabled = .f.
thisform.cmdTop.Enabled = .f.
thisform.cmdnext.Enabled = .t.
thisform.cmdbott.Enabled = .t.
endif

if eof()
thisform.cmdnext.Enabled = .f.
thisform.cmdbott.Enabled = .f.
endif
thisform.showrec


-----------------
PROBLEM: But for the First Record we have to click one more time to make it
disabled.
----------------

"For Previous Button" : Click Event
---------------------


sele Register
set order to tag Register
if not bof()
skip -1
endif
thisform.cmdbott.enabled = .t.
thisform.cmdnext.enabled = .t.

if bof()
thisform.cmdPrev.Enabled = .f.
thisform.cmdTop.Enabled = .f.
thisform.cmdnext.Enabled = .t.
thisform.cmdbott.Enabled = .t.
endif

if eof()
thisform.cmdnext.Enabled = .f.
thisform.cmdbott.Enabled = .f.
endif
thisform.showrec

-------------------

Note : Is the code right ?

-------------------

"For Next Button" : Click Event
------------------

sele Register
set order to tag Register
if not eof()
skip
endif
thisform.cmdprev.enabled = .t.
thisform.cmdtop.enabled = .t.
if eof()
thisform.cmdPrev.Enabled = .t.
thisform.cmdTop.Enabled = .t.
thisform.cmdnext.Enabled = .f.
thisform.cmdbott.Enabled = .f.
endif

if bof()
thisform.cmdPrev.Enabled = .f.
thisform.cmdTop.Enabled = .f.
endif
thisform.showrec
---------------------

Note : Is the code right ?

--------------------

"For Bottom Button" : Click Event

-------------------


sele Register
set order to tag Register
if not bof()
go bott
endif
thisform.cmdnext.Enabled = .f.
thisform.cmdbott.Enabled = .f.
thisform.cmdPrev.Enabled = .t.
thisform.cmdTop.Enabled = .t.

if bof()
thisform.cmdPrev.Enabled = .f.
thisform.cmdTop.Enabled = .f.
thisform.cmdnext.Enabled = .t.
thisform.cmdbott.Enabled = .t.
endif

if eof()
thisform.cmdnext.Enabled = .f.
thisform.cmdbott.Enabled = .f.
endif
thisform.showrec
----------------------

PROBLEM : I don't get this button disabled when I am at last record.
--------------------


Pl. Help


I don't want to use any other classes if available because I have already
used this code in all the buttons of all the forms. So pl. help me
correcting this code.


Thanks in Advance

Ashish Patel
Next
Reply
Map
View

Click here to load this message in the networking platform