Print Page | Close Window

Keybindings and two CommandBars?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=444
Printed Date: 04 December 2024 at 2:40pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Keybindings and two CommandBars?
Posted By: Bjarne
Subject: Keybindings and two CommandBars?
Date 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




Replies:
Posted By: SuperMario
Date 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.


Posted By: Boyd
Date 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.


Posted By: Bjarne
Date 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



Posted By: SuperMario
Date 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.





Posted By: SuperMario
Date 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?




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net