Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Working with Multiple CommandBar Objects
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Working with Multiple CommandBar Objects

 Post Reply Post Reply
Author
Message
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Topic: Working with Multiple CommandBar Objects
    Posted: 02 March 2004 at 3:56pm

I've seen several posts throughout the forums where people have had issues using more than one CommandBars object in the same application.  Two very common scenarios for using multiple CommandBars objects are:

  • One CommandBars object on an MDI form and another for each MDI Child Form
  • One CommandBars object for the main form and another CommandBars object for a DockingPane docked to the main form

The main reason for using mutiple CommandBars objects is that the CommandBars object can only control toolbars on the form it is contained within (I believe this is an ActiveX limitation only, but I could be wrong).  That's the reason that MDI Child forms and DockingPanes have to have their own CommandBars object.

A well-noted issue is that the KeyBindings are only executed for the main CommandBars object.  Any KeyBindings on other forms are ignored.

Another big issue seems to be with Customizing toolbars.  The ablity to customize toolbars and menus was a big selling point for the CommandBars control.  This ablity to customize, however, becomes a nightmare when the same control needs to be displayed on more than one CommandBars object (i.e. have 'Cut' in the 'Edit' menu of the main form but also as a toolbar control on a DockingPane).  Even though the two controls have the same ID, any customization made the control on the main CommandBars menu is not replicated to the same control on the DockingPane.  This means that Captions, Images, KeyBindings, etc are now "out of sync".  Without the ablity to keep the items in sync, it's not feasible to allow customization when you also need to have multiple CommandBars objects.

So what's the solution?  I don't know.  I'm hoping Codejock has the answer.

A solution to the Customization problem could possibly be resolved in two ways.

  1. Have a Global object for all CommandBars in the application that is used to automatically syncronize controls of the same ID between multiple CommandBar objects when any of those controls are changed.
  2. Expose an event for when any aspect of a Control is customized.  This would allow the developer to propogate that change to the other CommandBar controls.

A possible solution for the KeyBindings problem might be:

  1. When an accelerator key is pressed, determine which form has focus.  If a KeyBinding exists for the CommandBar on that form, issue the Execute event.  Otherwise, send the accelerator to the parent of that form.
  2. Exponse an event for when a KeyBinding is activated that gets called BEFORE the Execute event.  Give the developer the ability to reject the accelerator and prevent the Execute event from being fired.  The developer can then route the accelerator appropriately to a different CommandBars object.  In this scenario, it would also be useful to be able to determine which controls use a particular KeyBinding (I don't currently know of a method).

If anyone else has noticed problems using the more than one CommandBars object in the same project, please post them here.  Hopefully Codejock will be able to provide some feedback with workarounds or implement a solution in a future build of the controls.

Of course, the best solution would be to have a single CommandBars object that allows you to create a CommandBar on ANY form (including the ability to dock/undock toolbars between multiple forms) .

I look forward to your feedback.

Back to Top
Bjarne View Drop Down
Newbie
Newbie
Avatar

Joined: 30 December 2003
Location: Denmark
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bjarne Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2004 at 12:27pm

Hello Boyd,

I have not much to add to what you already so nicely have said in your comment. So I can only say that I have the same challenges as you express above and would really like a guidence on how to work around it for now, and a fix for the medium and longer term.

Bjarne

Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 02 April 2004 at 7:57pm

Bjarne,

I wanted to let you know that several improvements in the next release have helped with the problems I previously described.

  • You will be able to configure customizable toolbars through code, so you have a lot more control over customization and aren't limited to using the Designer Studio.  This also allows you to select which controls appear in the 'Customize' dialog.
  • You can disable the 'Keyboard' tab of the 'Customize' dialog for Command Bars where the Key Bindings won't work.  This at least prevents the users from needlessly configuring shortcuts in those Command Bars.

It's still not a perfect solution, but the new features are a big improvement.  I'd still like to see a single Command Bar that can dock/undock between different Command Bar hosts.

Back to Top
Bjarne View Drop Down
Newbie
Newbie
Avatar

Joined: 30 December 2003
Location: Denmark
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bjarne Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2004 at 1:44am
Thanks Boyd,
Really looking forward to trying it out. But if I understand you correct there is not really a workaround for having more than one CommandBar on a Form and using Keyboard Shortcuts?
Anyway, I will have to work around this then in the design of the forms.

Is the April 5th, the realese date for the next version?

Bjarne
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2004 at 6:16am
Yes, v8.70 will be available on 4/5/04.
Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2004 at 7:53am

Correct.  There is still no official fix for shortcuts being recognized on any CommandBar other than the main one.

Back to Top
svenn View Drop Down
Newbie
Newbie


Joined: 07 May 2004
Location: Norway
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote svenn Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2005 at 7:44am
Are there any news on shortcuts and multiple CommandbBar objects?

.svenn
Back to Top
svenn View Drop Down
Newbie
Newbie


Joined: 07 May 2004
Location: Norway
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote svenn Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2005 at 8:08am
It is a bit strange that no action has been taken upon this issue.

Searching the forums I find several topics related to the same issue. Obviously several are experiencing the same problems with shortcut keys.

Codejock engineers, could you please look at how we can resolve problems with shortcut keys and multiple commandbars?

.svenn
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2005 at 8:53am
Please attach sample that illustatrates problem
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
svenn View Drop Down
Newbie
Newbie


Joined: 07 May 2004
Location: Norway
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote svenn Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2005 at 9:18am
The attached sample illustrates the problem.

The main toolbar at the bottom does not respond to accelerator keys when my utility toolbar on the top right is displayed.

In my production code these toolbars reside in different components (DLLs) and can not be placed on the same container (form, user control or picture box).

Is there any way I can force one of these to take precedence in handling shortcut keys, or better yet, have both properly respond to shortcuts?

.svenn2005-11-29_091826_Commandbar_Sample.zip
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2005 at 2:49am

Thank you for sample, we changed behaviour for 9.81 release.

In 9.81 will both properly respond to shortcuts. (but only one if same shortcut used)

Thanks.

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
svenn View Drop Down
Newbie
Newbie


Joined: 07 May 2004
Location: Norway
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote svenn Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2005 at 2:51am
Oleg,
That is great news, and saves me a lot of hassle.
When will 9.81 be availe for download?

Svenn
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.