Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Keybindings and two CommandBars?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Keybindings and two CommandBars?

 Post Reply Post Reply
Author
Message
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 Topic: Keybindings and two CommandBars?
    Posted: 14 February 2004 at 9:18am

I have two CommandBars placed on one form. I have added keybindings for different keys on the two Bars. But only the keybindings added for the first Commandbar work. Is this expected behaviour or a bug?

Regards,

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: 14 February 2004 at 3:10pm
I am not sure if this is possible.  If I am understanding you correctly, you have two CommandBars controls added to the form.  What you could do is have only one CommandBars control on your form.  Then add all of your command bars to the CommandBars control.  In the SDI sampls they use only one CommandBars control and they have both the standard toolbar and themes toolbar added to this control.  Doing it this way you can add as many toolbars as you like.  If there are times you want to see only certain toolbars you could just hide them when they are not wanted.  If you are trying to have different acvtive menu bars then you would add all of the controls needed to the active menu bar and hide them when you don't want to see them.  I haven't tried the hiding of active menu controls yet so I am not sure it is possible.  You would probably have to give the controls in the active menu bar an Id so you could find them.
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: 14 February 2004 at 3:44pm
I have experienced a similar problem with the key bindings.  I have a CommandBars control on my main form.  I also have CommandBars in various panes docked to the main form.  The key bindings only seem to work for the main CommandBar.
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: 14 February 2004 at 3:53pm

The reason for having two Commandbars is that I have a Form with a RTF Control on it, and at the top of that RTF Edit control I have a CommandBar with Cut, Copy, Paste, Bold etc attached.

 The reason for doing it this way is that I need to control exactly where the Toolbar is placed, (It has to be at the top of the RTF Edit window) and I could not figure out any other way than putting a CommandBar in a Picture Box and control exact placement of that Picture Box.

The obvious choice would be to create a floating toolbar and control placement of that, but with the current samples included and the content of the Help file, I could not figure out how to do that. So if anyone has an example of that I would appreciate it.

But as Boyd pointed out, there seems to be a problem anyway, which I hope Codejock can look into.

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: 14 February 2004 at 5:17pm
If you want to create a floating toolbar, you can use just one CommandBars control on your form.  When you add the toolbar set the type as xtpBarFloating.  For example:

Set ToolBar = CommandBars.Add("Standard", xtpBarFloating")

To keep users from docking the toolbar you need to use the xtpFlagFloating:

ToolBar.EnableDocking xtpFlagFloating

I am not sure if you can set the position of this toolbar.  but the keybindings work.  When I tried to place the control in a picture box I couldn't even get the buttons to respond.  I wonder if you added the controls to the CommandBars control on the main form and then hide the control giving them the same ID as the ones in the picture box, then add keybinding to those hidden controls.  This might work.



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: 14 February 2004 at 10:29pm
In case anyone was wondering, In my first response I spoke about using only one CommandBars control for all of your toolbars and active menu controls.  To do this, make sure you add all toolbars and active menu controls . 

Say you have File, Edit, View, Window, Help in your active menu bar.  To hide the "Edit" control use:
     CommandBars(1).Controls(2).Visible = False

Say you also have two toolbars, to hide the second toolbar, which is the third command bar (active menubar plus two toolbars) use:
    CommandBars(3).Visible = False

So you can see it would be easy to hide and unhide controls , menus, and toolbars whenever you like.  Read the previous post as well, that may help in using a floating toolbar.  I have not seen anything that will allow you to control  the position of the command bar.  Anyone know how to position the floating toolbar?



Edited by SuperMario
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.203 seconds.