How to Coordinate a Browse Window with a Control Screen

ID: Q109781

2.50 2.50a 2.50b | 2.00 2.50 2.50a 2.50b

WINDOWS          | MS-DOS

The information in this article applies to:

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: KBSubcategory: FxprgBrowse
Keywords          : kbcode FxprgBrowse 
Version           : 2.50 2.50a 2.50b | 2.00 2.50 2.5
Platform          : MS-DOS WINDOWS

Last Reviewed: May 22, 1998