Keybindings and two CommandBars? |
Post Reply |
Author | |
Bjarne
Newbie Joined: 30 December 2003 Location: Denmark Status: Offline Points: 28 |
Post Options
Thanks(0)
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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.
|
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
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.
|
|
Bjarne
Newbie Joined: 30 December 2003 Location: Denmark Status: Offline Points: 28 |
Post Options
Thanks(0)
|
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |