How to Coordinate a Browse Window with a Control Screen

Last reviewed: April 30, 1996
Article ID: Q109781
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b

SUMMARY

You can seamlessly incorporate a series of navigation push buttons (such as those provided in CONTROL2.SCX in the GOODIES\FNDATION\SCREENS subdirectory) with a Browse window so that a single click on a navigation button refreshes the Browse window appropriately.

Normally, two mouse clicks are required to perform the operation: the first to activate the window containing the push buttons, the second to select one of the buttons. The code example below demonstrates how to do this with a single mouse click.

MORE INFORMATION

The following code example assumes that there are no ON KEY LABEL assignments or keyboard macros assigned to the F12 function key.

   SET TALK OFF
   USE c:\<foxpro directory name>\tutorial\customer
   ON KEY LABEL F12 ACTIVATE WINDOW customer
   DEFINE WINDOW mbrow FROM 1,1 TO 18,60
   DEFINE WINDOW ctrl FROM 19,1 TO 22,60
   ACTIVATE WINDOW ctrl
   @1,1 GET choice ;
      PICTURE "@*HN \<Top;\<Prior;\<Next;\<Bottom;\<Add;\<Quit" ;
      DEFAULT 1 ;
      VALID mval()

   READ CYCLE WHEN mfunc()
   RELEASE WINDOW customer
   RELEASE WINDOW ctrl
   ON KEY LABEL F12

   FUNCTION mval
   DO CASE
   CASE choice = 1
      GO TOP
   CASE choice = 2
      IF !BOF()
         SKIP -1
      ENDIF
      IF BOF()
         WAIT WINDOW "Top of file" TIMEOUT 0.5
         GOTO TOP
      ENDIF
   CASE choice = 3
      IF !EOF()
         SKIP 1
      ENDIF
      IF EOF()
         WAIT WINDOW "Bottom of file" TIMEOUT 0.5
         GO BOTTOM
      ENDIF
   CASE choice = 4
      GO BOTTOM
   CASE choice = 5
      APPEND BLANK
   CASE choice = 6
      CLEAR READ
   ENDCASE
   KEYBOARD '{f12}'

   FUNCTION mfunc
   BROWSE WINDOW mbrow NOWAIT SAVE
   KEYBOARD '{F12}'


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.50b pushbuttons
KBCategory: kbprg kbcode
KBSubcategory: FxprgBrowse


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.