Code Example Shows How to Manage Navigation ButtonsID: Q123967 2.00 2.5x 2.60 2.60a | 2.50x 2.60 2.60a 3.00| 2.50b 2.50c 2.60 2.60a
The information in this article applies to:
SUMMARYWhen creating a screen, most developers need to add navigation buttons to move through the database. You can easily put a push button on a screen to go forward one record, but you also need to control button behavior when reaching the beginning or the end of a database. For example, if the user is navigating through a table and reaches the end of that table, you might want to have the Next and Bottom buttons disabled. Likewise, when the user reaches the top of the table, you might want to have the Top and Prior buttons disabled. This article shows by example how to do this.
MORE INFORMATIONThe code sample in this article moves the pointer before or after the next or prior record you really want to display, thus allowing you to test for BOF() and EOF() conditions and have your program respond accordingly by disabling or enabling the appropriate buttons.
Code SampleNOTE: While this code can serve as a solid base for use in your own work, it is by no means necessarily the only or best way of handling buttons. In its present form, the code does not check the status of a record to see if it is deleted. If deleted is OFF (the default), this code has the potential to misbehave, so you need to check for and handle deleted records and other types of exceptions. You might want to add code to the "On Screen Entry" or "When" clause code snippet, because "Top" and "Prior" are not valid at the beginning of a database. You may need to add this code:
Place the following code in the VALID clause of your button array, and
change the name of the "Buttnvar" variable to the name of the variable you
are actually using:
DO CASE ENDCASE
You could place the "Show Gets" command at the end of the CASE statement. However, sometimes it provides a snappier response when placed at the end of a given instruction. Additional reference words: VFoxWin 3.00 FoxWin FoxMac FoxDos 2.00 2.50 2.50a 2.50b 2.50c 2.60 2.60a KBCategory: kbui KBSubcategory: FxprgGeneral
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |