×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Toolbar: How to make it non-dockable
2

Toolbar: How to make it non-dockable

Toolbar: How to make it non-dockable

(OP)
Dear friends,

This is actually in continuation with one of my previous regarding On Screen Keyboard.
I managed to make one on my own (with help of inputs from Tek-Tips and other sources) based on ToolBar and it works fine.

Now, I am not able to make it Non-Dockable. If the On Screen Keyboard (a toolbar in fact) gets dragged by mistake, many times it goes to one of the edges of screen and gets docked there. I want to prevent this. However, I am not able to find a property or a way to achieve this.

Any idea?
Thanks in advance

Rajesh

RE: Toolbar: How to make it non-dockable

The best I can think of is puttin this into the AfterDock event:

CODE

If this.docked
   this.Dock(-1)
EndIf 

the help on the BeforeDock event tells you, that neither NODEFAULT nor RETURN .F. from it prevents docking, so all you seem to be able to do is undock, right after docking. It will still have an effect on the button positions, especially if you dock a toolbar to the left or roght side. To get that back to normal you would also need to reset width and height to keep the keyboard aspect ratio.

Chriss

RE: Toolbar: How to make it non-dockable

(OP)
Hi Chriss,

Thanks.
Let me try that.

Rajesh

RE: Toolbar: How to make it non-dockable

It might also be worth putting NODEFAULT in the DblClick event, given that a toolbar can be docked by double clicking on its title bar.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Toolbar: How to make it non-dockable

Rajesh,

What Mike said is exactly right - that's what we do.

RE: Toolbar: How to make it non-dockable

(OP)
Dear Chriss & Mike,

Fantastic!

I modified both AfterDock and DblClick events. In the INIT of form, in which the keyboard is invoked, I saved the initial position of the keyboard and I reset the keyboard position there in the AfterDock method.

Thanks dears
Rajesh

RE: Toolbar: How to make it non-dockable

Quote (Rajesh Karunakaran)

I reset the keyboard position there in the AfterDock method

good idea, that's always a valid position. you could also store the current Left and Top values in beforeDock and depending on DockPosition restore one of them, i.e. when the docking is left or right, you can restore the last top value and at least keep the keyboard toolbar in the height the user wanted it to be. At the same time position the keyboard so it just touches the side it was docked to.

It's not as trivial as storing the last top and left in the BeforeDock event, because a) beforedock also happens when you undock by doingthis.dock(-1) and you overwrite what you wanted to reset to and b) the last top and left values are the last position the window started to be dragged, not the last top and left drag position before docking.

It's a simple solution to put the keyboard in its home position. The user may try to move it once more, avoiding the dock and position reset.

Chriss

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close