WDockable()
This function, added in VFP 7, lets
you check whether a specified window is dockable, and lets you
change that state.
Usage
|
lDockable = WDOCKABLE( cWindow [, nNewState | lNewState ] )
|
Parameter
|
Value
|
Meaning
|
cWindow
|
Character
|
The name of the window.
|
nNewState, lNewState
|
Omitted
|
Return the current dockability status of the window.
|
0 or .F.
|
Make the window not dockable.
|
1 or .T.
|
Make the window dockable.
|
lDockable
|
.T.
|
The window is currently dockable.
|
.F.
|
The window is not currently dockable.
|
Beginning in VFP 7, many of the VFP system windows can be docked.
This includes the Command Window, the Data Session window, the
Property Sheet, the new Document View window, and several others.
In most cases, the names of these windows are what you'd expect
("Command" for the Command window, "Properties" for the Property
Sheet, and "Document" or "Document View" for the Document View
window). Only FoxPro old-timers are likely to guess the name for
the Data Session window—it's "View", which was the caption of
that window in older FoxPro versions.Because dockable windows
have some behaviors (like being always on top) that developers
may find annoying, rather than just make this change
unilaterally, the VFP team decided to give people a choice. All
of the affected windows can be made dockable or not dockable.
Interactively, you do this by right-clicking on the title bar and
checking or unchecking the Dockable item.This function lets you
do the same thing programmatically, and also provides a way to
find out the status of any window. Note that, when you change the
dockability of a window, the function returns the new value. We
were prepared to rant about having to pass a numeric value but
getting back a logical value—until we tried it. It turns out
that, despite the documentation, this function happily accepts
logicals for the new value, so you can just save the current
value and restore it later without having to do any type
conversions. Nice job by the Fox team.If you pass the name of a
window that can't be dockable, the function returns .F. without
choking. That's true even if you try to make said window
dockable. However, if you pass the name of a nonexistent window,
you get an error (appropriately, in our view). Be aware that
"nonexistent" in this context includes system windows that aren't
open at the moment.Note that WDOCKABLE() returns .T. for
toolbars, both VFP's and yours, and .F. for forms.
Example
|
* Check on Command window
? WDOCKABLE( "Command" )
* Make it dockable
? WDOCKABLE( "Command", 1 )
|
Back to Table of Contents
Copyright © 2002-2018 by Tamar E. Granor,
Ted Roche, Doug Hennig, and Della Martin. Click for license
.