Solved

Closing Toolbars

Posted on 1998-11-26
7
311 Views
Last Modified: 2012-05-04
How can I capture the close event of a toolbar when is dragged out of the form, so I can change the check in my menu options?
With example, please.
0
Comment
Question by:quique
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:jecksom
ID: 1347977
hi quique!

toolbar = Ttoolbar , or desktop's taskbar ? dragged out the form = hidden ?

Jecksom

0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1347978
If you have a menu like this:

&View
      &Toolbar
      &Status bar

and so on, then you can set the checked property of the Toolbar menu item inside the View menu item click event.

Double click the TMainMenu component that is on your form. Double click the View menu. Type:
ToolbarMenu1.Checked := Toolbar.Visible;

The menu will be updated before is displayed. This way, you don't need to monitor the close event of the toolbar.

0
 
LVL 1

Author Comment

by:quique
ID: 1347979
The problem is that it's a dockable toolbar and if you drag this toolbar out of it's docksite, it becomes a like little window with just a close button, and it is when you click this button and close this little window when the menu check has to change.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 3

Expert Comment

by:philipleighs
ID: 1347980
I think you didn't understand my answer.
I know it is a dockable toolbar which can be closed when not docked.
The point is that the check on the menu does not need to be updated until the parent menu is opened.

Maybe this will demonstrate.
Create a new app, add a controlbar and put a toolbar inside. Set DockKind to dkDock.
Add the menu in my last comment.

Name of View menu item: View1
Name of Toolbar menu item: ToolbarMenuItem
Name of Toolbar:  Toolbar1

In the OnView1Click add this code:
ToolbarMenuItem.Checked := Toolbar1.Visible;

In the OnToolbarMenuItemClick type this code:
Toolbar1.Visible := not Toolbar1.Visible;

Run your program. The check next to ToolbarMenuItem is always synchronised with the visibility of the toolbar, even if the close button on the toolbar is clicked.

0
 
LVL 1

Author Comment

by:quique
ID: 1347981
The problem is that there isn't an onclose event in the toolbar, so there's no way to uncheck the 'Visible Toolbar' menu option when you close the toolbar. It must work both ways, using the menu option and closing the toolbar. Is it more clear now the problem?
0
 
LVL 3

Accepted Solution

by:
philipleighs earned 50 total points
ID: 1347982
quique,
Reread my answer.
There is *NO* need for an OnClose event for the toolbar.

The menu item that you want checked only needs to be updated just before it is displayed to the user. OK, now reread that sentence until you realise that you don't need OnClose.

You can detect when it is about to be displayed because the *PARENT* menu gets an ONCLICK event.

Look at this menu carefully:
View
      Toolbar

The check next to "Toolbar" should be updated in the OnClick event of the *VIEW* menu item.
You "DON'T* need to update the check when the floating toolbar is closed because the user won't see the check until they open the menu.

If you still don't understand, just follow the steps in my second answer and run the program. Play with the program until you realise that it works.

So here is how it works.
1. The toolbar is floating and visible.
2. The menu item is checked.

3. You close the toolbar.
4. The menu item is still ticked (this is fine).

5. The user opens the View menu
6. Now the menu item is unticked!!! Exactly what you want.

No, this isn't magic. The OnViewClick removed the check *BEFORE* the drop down menu became visible to the user.

Do you get it now? I can't make it any simpler.
0
 
LVL 1

Author Comment

by:quique
ID: 1347983
Thanks for all, folk!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question