Article ID: 123967
Article Last Modified on 12/3/2003
&& Disable Top and Prior buttons on startup. SHOW GET Buttnvar,1 DISABLE && Disable "Top" SHOW GET Buttnvar,2 DISABLE && Disable "Prior"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
CASE Buttnvar = 1 && 'TOP' button
GO TOP
SCATTER MEMVAR
SHOW GET Buttnvar,1 DISABLE && Disable "Top"
SHOW GET Buttnvar,2 DISABLE && Disable "Prior"
IF (RECCOUNT() > 1)
SHOW GET Buttnvar,3 ENABLE && Enable "Next"
SHOW GET Buttnvar,4 ENABLE && Enable "Bottom"
ELSE
SHOW GET Buttnvar,3 DISABLE && Disable "Next"
SHOW GET Buttnvar,4 DISABLE && Disable "Bottom"
ENDIF
SHOW GETS
WAIT WINDOW "At first record" TIMEOUT 1
_CUROBJ = OBJNUM(Buttnvar)+3 && Transfer focus to "Next" button
CASE Buttnvar = 2 && 'PRIOR' button
SKIP - 1
IF NOT BOF()
SCATTER MEMVAR
ELSE
WAIT WINDOW "At first record" TIMEOUT 1
SHOW GET Buttnvar,1 DISABLE && Disable "Top"
SHOW GET Buttnvar,2 DISABLE && Disable "Prior"
ENDIF
IF (RECCOUNT() > 1)
SHOW GET Buttnvar,3 ENABLE && Enable "Next"
SHOW GET Buttnvar,4 ENABLE && Enable "Bottom"
ELSE
SHOW GET Buttnvar,3 DISABLE && Disable "Next"
SHOW GET Buttnvar,4 DISABLE && Disable "Bottom"
ENDIF
SHOW GETS
CASE Buttnvar = 3 && 'NEXT' button
IF NOT EOF()
SKIP 1
ENDIF
IF EOF()
SKIP - 1
WAIT WINDOW "At last record" TIMEOUT 1
SHOW GET Buttnvar,3 DISABLE && Disable "Next"
SHOW GET Buttnvar,4 DISABLE && Disable "Bottom"
ELSE
SHOW GET Buttnvar,1 ENABLE && Enable "Top"
SHOW GET Buttnvar,2 ENABLE && Enable "Prior"
SCATTER MEMVAR
ENDIF
SHOW GETS
CASE Buttnvar = 4 && 'BOTTOM' button
GO BOTTOM
SCATTER MEMVAR
SHOW GET Buttnvar,3 DISABLE && Disable "Next"
SHOW GET Buttnvar,4 DISABLE && Disable "Bottom"
IF (RECCOUNT() > 1)
SHOW GET Buttnvar,1 ENABLE && Enable "Top"
SHOW GET Buttnvar,2 ENABLE && Enable "Prior"
ELSE
SHOW GET Buttnvar,1 DISABLE && Disable "Top"
SHOW GET Buttnvar,2 DISABLE && Disable "Prior"
ENDIF
_CUROBJ = OBJNUM(Buttnvar)+1 && Transfer focus to "Prior" button
SHOW GETS
WAIT WINDOW "At last record" TIMEOUT 1
CASE Buttnvar = 5 && 'QUIT' button
CLEAR READ
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 query words: VFoxWin FoxWin FoxMac FoxDos
Keywords: kbcode KB123967