Add 2 toolbars in 1 line |
Post Reply |
Author | |
Voha
Newbie Joined: 22 March 2004 Location: Canada Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 01 April 2004 at 11:37am |
Hi all! I cannot find solution how to add 2nd toolbar near 1st. It always add next toolbar below the previous. I dock them all at the top. In Infragistics ActiveToolBar there is a solution when DocRow and DockColumn properties should be specified. May be i just missed somethig? But there is no any axample where tollbars whould be loaded in such way. But it is possible to move 2nd toolbar manualy . So i think sulution exist but i just cannot find it. tnx. Voha |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Look at CommandBars dynamic popup sample. Copy the code below to
a new project and add a CommandBars control and ImageList control if
you want images:
Private Sub DockRightOf(BarToDock As CommandBar, BarOnLeft As CommandBar) Dim Left As Long Dim Top As Long Dim Right As Long Dim Bottom As Long CommandBars.RecalcLayout BarOnLeft.GetWindowRect Left, Top, Right, Bottom CommandBars.DockToolBar BarToDock, Right, (Bottom + Top) / 2, BarOnLeft.Position End Sub Private Sub Form_Load() Dim Control As CommandBarControl Dim ControlFile As CommandBarPopup Set ControlFile = CommandBars.ActiveMenuBar.Controls.Add(xtpControlPopup, 0, "&File", -1,0) With ControlFile.CommandBar.Controls .Add xtpControlButton, ID_FILE_NEW, "&New", -1, False End With Dim ToolBar As CommandBar Set ToolBar = CommandBars.Add("Standard", xtpBarTop) With ToolBar.Controls Set Control = .Add(xtpControlButton, ID_FILE_NEW, "&New", -1, False) Control.DescriptionText = "Create a new document" End With Dim ExtendedBar As CommandBar Set ExtendedBar = CommandBars.Add("Extended", xtpBarTop) With ExtendedBar.Controls Set Control = .Add(xtpControlSplitButtonPopup, ID_TOOLS_UNDO, "Undo") Control.CommandBar.Controls.Add xtpControlButton, ID_TOOLS_UNDO, "Undo" .Add xtpControlComboBox, ID_TOOLS_UNDO_COMBO, "Undo Combo" End With CommandBars.AddImageList imlToolbarIcons DockRightOf ExtendedBar, ToolBar End Sub Edited by SuperMario |
|
MarcelN
Newbie Joined: 20 December 2004 Location: Netherlands Status: Offline Points: 10 |
Post Options
Thanks(0)
|
When using this method to dock a toolbar to the right, it's still positioned wrong. I debugged our application and found the values returned from GetWindowRect to be very weird: Also, the width of the toolbar is too large. Are these values in pixels? The values seem a bit high. I do have a multi-monitor setup, but after disabling my second monitor it still wouldn't work correctly. These toolbars should be aligned next to eachother, not that far apart. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
I don't have VS 2005 Beta 2 to test on, but here is the C# code I use:
private void DockRightOf(XtremeCommandBars.CommandBar BarToDock, XtremeCommandBars.CommandBar BarOnLeft, Boolean VerticalBar) { int left, top, right, bottom; XtremeCommandBars.CommandBar LeftBar = BarOnLeft; CommandBars.RecalcLayout(); LeftBar.GetWindowRect(out left, out top, out right, out bottom); if (VerticalBar == false) CommandBars.DockToolBar(BarToDock, right, (bottom + top) / 2, LeftBar.Position); else CommandBars.DockToolBar(BarToDock, (left + right) / 2, Bottom, LeftBar.Position); } Also, make sure you are adding your icons BEFORE you use this function. |
|
MarcelN
Newbie Joined: 20 December 2004 Location: Netherlands Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Thank you Mario (but our princess is in another castle...),
Since I don't know which icons belong to the toolbar items, I solved the problem another way. By adding the toolbars from right to left, it's possible to dock the next toolbar on the left. For this the size of the toolbars doesn't matter :) I do have another question though. (still using C# in Visual Studio 2005 beta 2) I copy some menu-items from a .net ToolStrip to a CodeJock CommandBar. .net uses a ToolStripControlHost for custom controls, similar to the CommandBarControlCustom class. The CommandBarControlCustom class needs the handle of a control, which can be assigned via a property. The problem is this: We have a dynamic toolbar, which can change over time. When it changes the entire CommandBar is cleared, and new controls are added. Whenever a CommandBarControlCustom item is present and the CommandBar is cleared + filled again, the custom control is still visible (but not usable) By moving over the control with the mouse the application crashes with the following error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" It only occurs when CommandBarControlCustom items are used. Does the CommandBarControls.DeleteAll() method release all the handles to controls properly? Or could there be another problem (and solution)? ==== EDIT ==== By manually releasing the handles of CommandBarControlCustom items, it does work as expected.
==== EDIT ==== More progress... I created a CommandBarControlCustom object with a Handle to a .net TextBox. This worked, the textbox was shown correctly :) One problem does occur though. When another CommandBarControl is added AFTER the Custom control, the backspace key doesn't work. Even worse, there are some focus problems with custom .net UserControls in a CommandBarControlCustom object. This always occurs, even when the Custom control isn't followed by another control. Edited by MarcelN |
|
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 |