Pages: 1
Print
Author Topic: Create toolbars  (Read 3702 times)
eamick
Member

Posts: 11


« on: July 30, 2012, 11:48:41 AM »

When exactly can I create a new toolbar from a script? I can't tell which event macro, if any, is appropriate.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #1 on: July 30, 2012, 02:12:04 PM »

The event macro provided for making menu and toolbar modifications is On_Default_CommandBars_Complete.
« Last Edit: July 30, 2012, 02:13:47 PM by Derek Read » Logged
eamick
Member

Posts: 11


« Reply #2 on: July 31, 2012, 05:49:36 AM »

Strange. The online documentation has a note that makes it sound as if you can't create toolbars in that macro. Perhaps that note, which comes after a paragraph that also refers to On_CommandBars_Activate and On_CommandBars_DeActivate,  is referring to On_CommandBars_Activate and On_CommandBars_DeActivate; if so, the note is ambiguous, at least to me.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #3 on: July 31, 2012, 12:27:33 PM »

Do you mean this portion?

Quote
The event macro On_Default_CommandBars_Complete is called after the workspace has been loaded and toolbars have been set up. If you want to make modifications to the menus and toolbars, you can do it here; however, you cannot affect the visibility of toolbars from this event. Instead, use the On_CommandBars_Activate or On_CommandBars_DeActivate events.
Logged
eamick
Member

Posts: 11


« Reply #4 on: July 31, 2012, 01:25:57 PM »

That's the one. While I think of it, I'm having trouble getting the adding to work properly under Windows Vista with 7.0. When I exit the program, I always get a "program has stopped working" message.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #5 on: July 31, 2012, 02:26:53 PM »

What that translates to is this:

  • Use On_Default_CommandBars_Complete to add, remove or change toolbars and menus.
  • Setting the "visible" property for toolbars (on a CommandBarControl or CommandBar object) will have no effect inside the event On_Default_CommandBars_Complete since the toolbars are rendered after this event runs. The only thing happening inside that event is the building up of toolbars and menus before they are rendered.

In most cases I wouldn't set the Visible property anyway since that is usually something I would leave up to the user to decide.
Logged
Pages: 1
Print
Jump to: