ACTIVATE WINDOW Properties ACTIVATE WINDOW DocumentFWIW, here's some code I use to show/hide miscellaneous IDE windows. For example, pressing < F8 > shows/hides the document view window.
*-- setup some IDE windows stuff IF NOT PEMSTATUS(_screen, "oWinHand",5) _screen.NewObject("oWinHand", "WinHand", "WindHand.prg") ENDIF ON KEY LABEL f5 _screen.oWinHand.ToggleShowHide("View", "Properties", "'{F2}'") ON KEY LABEL f7 _screen.oWinHand.ToggleShowHide("Properties", "View", "'{F7}'") ON KEY LABEL shift-f7 _screen.oWinHand.ToggleDefPropsOnly() ON KEY LABEL f8 _screen.oWinHand.ToggleShowHide("Document", "", "'{F8}'") ON KEY LABEL alt-f2 _screen.oWinHand.ToggleCommandWindow() ON KEY LABEL shift-f10 _screen.oWinHand.ToggleZoom() DEFINE CLASS WinHand AS Custom icMessageBoxCaption = "IdeWindowHandler" ilPrgZoomState = .f. ************************************************ PROCEDURE ToggleShowHide ************************************************ * Author............: Daniel Gramunt * Created...........: 24.08.2001 - 14:29:00 (Visual FoxPro 07.00.0000.9262) * Copyright.........: (c) Nokia, 2001 *) Description.......: Toggles the state of <tcWindowToActivate> from visible to invisible. *) : This method is typically called from OKLs and used to activate/deactivate *) : IDE windows such as the Document View, Properties sheet and the *) : View window. * Calling Samples...: * Parameter List....: tcWindowToActivate - Window to activate/deactivate * : [tcWindowToDeactivate] - Window to deactivate before activating the new * : window. This is typically used when 2 windows * : share the same location such as the Properties * : sheet and the view window. * : Optional. * : [tcKeyLabel] - Key label which called this method. This allows * : us to bypass this procedure if the debugger is * : active. Optional. * : [tlActivateCommand] - Specifies if the command window should be activated * : at the end of this method. * : Optional. Default = .f. * Major change list.: *-------------------------------------------------------------------------------------------------- LPARAMETERS tcWindowToActivate, tcWindowToDeactivate, tcKeyLabel, tlActivateCommand *-- check if we're in the debugger. IF This.IsDebug() *-- debugger is active, so we bypass this method and call the key *-- which was assigned to the OKL in the calling procedure. *-- Example: Instead of activating or deactivating the document view after *-- F8 has been pressed, we call a "clean" F8 which performs the *-- standard "Step Into" of the debugger. *-- IF VARTYPE(tcKeyLabel) = "C" AND NOT EMPTY(tcKeyLabel) KEYBOARD &tcKeyLabel PLAIN CLEAR RETURN ENDIF ENDIF *-- check current state IF WVISIBLE(tcWindowToActivate) DEACTIVATE WINDOW (tcWindowToActivate) ELSE *-- check if we need to deactivate another window before we *-- can activate the new window. We need to do this, otherwise *-- the second window is docked below the already active one. IF NOT EMPTY(tcWindowToDeactivate) IF WVISIBLE(tcWindowToDeactivate) DEACTIVATE WINDOW (tcWindowToDeactivate) ENDIF ENDIF ACTIVATE WINDOW (tcWindowToActivate) SHOW WINDOW (tcWindowToActivate) WDOCKABLE(tcWindowToActivate, .t.) IF tlActivateCommand ACTIVATE WINDOW Command ENDIF ENDIF *-- EOF Method ToggleShowHide ---------------------------------------------------------------------------- ************************************************ PROCEDURE ToggleCommandWindow ************************************************ *) Description.......: * Calling Samples...: * Parameter List....: * Major change list.: *-------------------------------------------------------------------------------------------------- IF WVISIBLE('Command') HIDE WINDOW Command ELSE KEYBOARD "{ctrl-f2}" && ACTIVATE WINDOW Command ENDIF *-- EOF Method ToggleCommandWindow ----------------------------------------------------------------------- ************************************************ PROCEDURE LoadFoxTools ************************************************ * Author............: Daniel Gramunt * Created...........: 24.08.2001 - 14:48:45 (Visual FoxPro 07.00.0000.9262) * Copyright.........: (c) Nokia, 2001 *) Description.......: * Calling Samples...: * Parameter List....: * Major change list.: *-------------------------------------------------------------------------------------------------- IF NOT "FOXTOOLS" $ SET("LIBRARY") IF FILE("FOXTOOLS.FLL") SET LIBRARY TO FOXTOOLS ADDITIVE ELSE MESSAGEBOX("Cannot find FoxTools.fll. Procedure canceled.", 16, PROGRAM(), 1000) ENDIF ENDIF RETURN "FOXTOOLS" $ SET("LIBRARY") *-- EOF Method LoadFoxTools ------------------------------------------------------------------------------ ************************************************ PROCEDURE ToggleZoom ************************************************ * Author............: Daniel Gramunt * Created...........: 26.08.01 - 21:36:21 (Visual FoxPro 07.00.0000.9262) * Copyright.........: (c) Nokia, 2001 *) Description.......: * Calling Samples...: * Parameter List....: * Major change list.: *-------------------------------------------------------------------------------------------------- #DEFINE WZ_MAXIMIZED 0 #DEFINE WZ_NORMAL 1 #DEFINE WZ_MINIMIZED 2 IF This.LoadFoxTools() lnWhandle = _WOnTop() IF lnWhandle = 0 MESSAGEBOX("_WOnTop() returned 0. Procedure canceled.", 16) RETURN "" ENDIF lcWindow = _WTITLE(lnWhandle) *-- check if we're in the debugger. IF This.IsDebug() RETURN ENDIF IF This.ilPrgZoomState _WZoom(lnWhandle, WZ_NORMAL) ELSE _WZoom(lnWhandle, WZ_MAXIMIZED) ENDIF This.ilPrgZoomState = NOT This.ilPrgZoomState ENDIF RETURN *-- EOF Method ToggleZoom -------------------------------------------------------------------------------- ************************************************ PROCEDURE ToggleDefPropsOnly ************************************************ * Author............: Daniel Gramunt * Created...........: 26.08.01 - 21:50:37 (Visual FoxPro 07.00.0000.9262) * Copyright.........: (c) Nokia, 2001 *) Description.......: Toggles the state of "Non-default properties only" of *) : the properties sheet. * Calling Samples...: * Parameter List....: * Major change list.: *-------------------------------------------------------------------------------------------------- IF WVISIBLE("Properties") ACTIVATE WINDOW Properties MOUSE CLICK AT 1,1 WINDOW Properties RIGHT KEYBOARD "N" PLAIN CLEAR ELSE ENDIF *-- EOF Method ToggleDefPropsOnly ----------------------------------------------------------------- ************************************************ PROCEDURE IsDebug ************************************************ * Author............: Daniel Gramunt * Created...........: 27.08.2001 - 09:25:26 (Visual FoxPro 07.00.0000.9262) * Copyright.........: (c) Nokia, 2001 *) Description.......: * Calling Samples...: * Parameter List....: * Major change list.: *-------------------------------------------------------------------------------------------------- IF This.LoadFoxTools() IF INLIST(_WTITLE(_WONTOP()), "Trace", "Watch", "Call Stack", "Debug Output", "Locals") RETURN .t. ELSE RETURN .f. ENDIF ENDIF *-- EOF Method IsDebug ----------------------------------------------------------------------------------- ENDDEFINE>Hi gang,