Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Open properties/doc view windows programmatically
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00566761
Message ID:
00566824
Views:
12
Evan,
You're right it's easy. Just omit the quotes < bg >
ACTIVATE WINDOW Properties
ACTIVATE WINDOW Document
FWIW, here's some code I use to show/hide miscellaneous IDE windows. For example, pressing < F8 > shows/hides the document view window.
This allows me to activate or deactivate any IDE window with a single key press, depending on what I'm currently doing. This is handy when you don't have a very high resolution screen like me. You probably want to adjust this to your preferences, but it might give you some ideas.
*-- 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 &lt;tcWindowToActivate&gt; 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 &amp;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}" &amp;&amp; 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,
>
>I'm having a brain freeze tonight (yeah, yeah, okay, no snide remarks from the peanut gallery...)(bg)
>
>How can I open the Properties and Document View windows programmatically? I've tried ACTIVATE WINDOW "Properties" (gives me a C0005 error), and I *know* there's an easy way that I'm just not awake enough to remember.
>
>Anybody?
>
>TIA,
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform