Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Closing Toolbars

Posted on 1998-11-26
7
Medium Priority
?
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

715 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