Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undockable Toolbar? 1

Status
Not open for further replies.

craigsboyd

IS-IT--Management
Nov 9, 2002
2,839
US
I must be missing something. I have a toolbar that I do not want the user to be able to dock (for reasons beyond the scope of my question, it has to be a toolbar not a form). The best I can muster so far is to undock it after they have docked it. I thought that perhaps a well placed NODEFAULT would do the job, but to no avail. Anyone know how to prevent a toolbar from ever being docked?

I may need to look into som API calls in order to change some behavior of the VFP toolbar window, but I am hopeful that someone else has run into this and overcome it before. Any suggestions or answers are greatly appreciated. Thanks.

boyd.gif

 
Craig,

Like Dave, I was also thinking of suggesting that you write some code in BeforeDock. You could store the current position, size and dock status in BeforeDock, and then restore them in AfterDock. It wouldn't be very pretty, though. Perhaps wrapping it in a Lockscreen would improve the costmetics.

In fact, I have the opposite problem. I have a toolbar which I want to keep permanently docked. If I programmatically dock it when I launch it, then set its Movable property to .F., that prevents the users from undocking it by dragging, but they can still undock it by double-clicking in the space between the buttons. I wish I could find a solution to that.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi Craig
=========
ToolBar.AfterDock
PROCEDURE AfterDock
LPARAMETERS nLocation
This.Dock(-1)

That will fix it.

Mike Lewis
==========
ToolBar.Init
PROCEDURE Init
This.Dock(0)
This.Movable = .f.
This will solve your problem.

:)


____________________________________________
ramani - (Subramanian.G) :)
 
HI MikeLewis

Sorry I left out a portion of code... in above..

PROCEDURE Init
This.Dock(0)
This.Movable = .f.

PROCEDURE dblclick
NODEFAULT

In fact the last portion of code is what you need.

:)


____________________________________________
ramani - (Subramanian.G) :)
 
Maybe you could use the 'Move' method to keep the toolbar from entering the dockable region.
Keep track of the mouse coordinates, last and current, and if the toolbar enters a the dockable region, bump it out by a pixel or four relative to the last position vs the current position.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi Craig,

I dont understand the situation. But anyhow thought of posting the sample I tried..

PUBLIC tbrDesktop
tbrDesktop = CREATEOBJ('mytoolbar')
tbrDesktop.SHOW

DEFINE CLASS myToolBar AS Toolbar
ADD OBJECT btnBold AS CommandButton
ADD OBJECT sep1 AS Separator
ADD OBJECT btnItalics AS CommandButton

btnBold.HEIGHT = 20
btnBold.WIDTH = 50
btnBold.Caption = "Bold"
btnItalics.HEIGHT = 20
btnItalics.WIDTH = 50
btnItalics.Caption = "Italic"
btnItalics.FontBold = .F.
nTop = 1
nLeft = 1

CAPTION = "Desktop Attributes"

PROCEDURE Activate
this.btnBold.FontBold = _SCREEN.FONTBOLD
this.btnItalics.FontItalic = _SCREEN.FONTITALIC
ENDPROC

PROCEDURE btnBold.CLICK
_SCREEN.FONTBOLD = !_SCREEN.FONTBOLD
This.FontBold =_SCREEN.FONTBOLD
ENDPROC

PROCEDURE btnItalics.CLICK
_SCREEN.FONTITALIC = !_SCREEN.FONTITALIC
This.FontItalic = _SCREEN.FONTITALIC
ENDPROC

PROCEDURE AfterDock
LPARAMETERS nLocation
This.Dock(-1,This.nLeft,This.nTop)

PROCEDURE Moved
This.nTop = This.Top
This.nLeft = This.Left

ENDDEFINE

____________________________________________
ramani - (Subramanian.G) :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top