![]() |
RESOLVED: Positioning Help!! (Screenshot added) |
Post Reply ![]() |
Author | |
JasonG ![]() Groupie ![]() Joined: 07 July 2008 Status: Offline Points: 76 |
![]() ![]() ![]() ![]() ![]() Posted: 07 July 2008 at 3:09pm |
Allow me to throw a curve.
I have 2 CommandBar controls on a form (commandBar and commandBar2). CommandBar is on the form itself, while CommandBar2 is on a frame (actually a picturebox) that gets moved around the form as the form is resized or splitters are changed. Each CommandBar control is used to control ONE toolbar. This works perfectly, as expected. However, now I want to add a 2nd toolbar to CommandBar2 - this is no problem, however - I would like this 3rd toolbar to be right-aligned when the form is resized. I assume there is a change to the "DockRightOf" function, but the measurements escape me for some reason. Any help would be greatly appreciated! Screenshot: http://www.trackmybookings.com/pimages/commandbar.jpg Code: Sub InitializeCommandBar() CommandBars.DeleteAll CommandBars2.DeleteAll Dim ToolBar As CommandBar Dim ReplyBar As CommandBar Dim ReplyBar2 As CommandBar Dim C As CommandBarButton 'MAIN TOOLBAR (ON FORM) Set ToolBar = CommandBars.Add("Standard", xtpBarTop) ToolBar.Customizable = False ToolBar.ContextMenuPresent = False ToolBar.ShowExpandButton = False ToolBar.ShowGripper = False Set C = ToolBar.Controls.Add(xtpControlButton, 1, "New") Set C = ToolBar.Controls.Add(xtpControlButton, 2, "Print") Set C = ToolBar.Controls.Add(xtpControlButton, 3, "Forward") Set C = ToolBar.Controls.Add(xtpControlButton, 4, "Chat") Set C = ToolBar.Controls.Add(xtpControlButton, 5, "Rotate") Set C = ToolBar.Controls.Add(xtpControlButton, 6, "Skin") ToolBar.ShowTextBelowIcons = True ToolBar.SetIconSize 32, 32 ToolBar.EnableDocking xtpFlagHideWrap 'SECONDARY TOOLBAR (FIRST ON FRAME) Set ReplyBar = CommandBars2.Add("Reply", xtpBarTop) ReplyBar.Customizable = False ReplyBar.ContextMenuPresent = False ReplyBar.ShowExpandButton = False ReplyBar.ShowGripper = False Set C = ReplyBar.Controls.Add(xtpControlButton, 7, "Send") Set C = ReplyBar.Controls.Add(xtpControlButton, 8, "Send Later") Set C = ReplyBar.Controls.Add(xtpControlButton, 9, "Send All") Set C = ReplyBar.Controls.Add(xtpControlSplitButtonPopup, 10, "Acknowledge") Set C = ReplyBar.Controls.Add(xtpControlButton, 11, "CC") ReplyBar.ShowTextBelowIcons = True ReplyBar.SetIconSize 32, 32 ReplyBar.EnableDocking xtpFlagHideWrap 'TERTIARY TOOLBAR (SECOND ON FRAME, RIGHT ALIGNED) Set ReplyBar2 = CommandBars2.Add("Reply2", xtpBarTop) ReplyBar2.Customizable = False ReplyBar2.ContextMenuPresent = False ReplyBar2.ShowExpandButton = False ReplyBar2.ShowGripper = False Set C = ReplyBar2.Controls.Add(xtpControlButton, 12, "Re-Send") Set C = ReplyBar2.Controls.Add(xtpControlButton, 13, "Trash") ReplyBar2.ShowTextBelowIcons = True ReplyBar2.SetIconSize 32, 32 'ReplyBar2.EnableDocking xtpFlagHideWrap '-----------ICON CODE REMOVED----------- Call DockRightOf(ReplyBar2, ReplyBar) End Sub Private Sub DockRightOf(BarToDock As CommandBar, BarOnLeft As CommandBar)
End SubDim Left As Long Dim Top As Long Dim Right As Long Dim Bottom As Long CommandBars2.RecalcLayout BarOnLeft.GetWindowRect Left, Top, Right, Bottom CommandBars2.DockToolBar BarToDock, Right, (Bottom + Top) / 2, BarOnLeft.Position |
|
![]() |
|
ijwelch ![]() Senior Member ![]() Joined: 20 June 2006 Status: Offline Points: 262 |
![]() ![]() ![]() ![]() ![]() |
Add these lines:
ReplyBar.EnableDocking xtpFlagStretchedShared Or xtpFlagHideWrap ReplyBar2.EnableDocking xtpFlagStretchedShared Or xtpFlagHideWrap before: Call DockRightOf(ReplyBar2, ReplyBar) |
|
![]() |
|
JasonG ![]() Groupie ![]() Joined: 07 July 2008 Status: Offline Points: 76 |
![]() ![]() ![]() ![]() ![]() |
This yields the same result - the second bar is still docking to the immediate right of the first... Any other Ideas?
Sub InitializeCommandBar() CommandBars.DeleteAll CommandBars2.DeleteAll Dim ToolBar As CommandBar Dim ReplyBar As CommandBar Dim ReplyBar2 As CommandBar Dim C As CommandBarButton Set ToolBar = CommandBars.Add("Standard", xtpBarTop) ToolBar.Customizable = False ToolBar.ContextMenuPresent = False ToolBar.ShowExpandButton = False ToolBar.ShowGripper = False Set C = ToolBar.Controls.Add(xtpControlButton, 1, "New") Set C = ToolBar.Controls.Add(xtpControlButton, 2, "Print") Set C = ToolBar.Controls.Add(xtpControlButton, 3, "Forward") Set C = ToolBar.Controls.Add(xtpControlButton, 4, "Chat") Set C = ToolBar.Controls.Add(xtpControlButton, 5, "Rotate") Set C = ToolBar.Controls.Add(xtpControlButton, 6, "Skin") ToolBar.ShowTextBelowIcons = True ToolBar.SetIconSize 32, 32 ToolBar.EnableDocking xtpFlagHideWrap Set ReplyBar = CommandBars2.Add("Reply", xtpBarTop) ReplyBar.Customizable = False ReplyBar.ContextMenuPresent = False ReplyBar.ShowExpandButton = False ReplyBar.ShowGripper = False Set C = ReplyBar.Controls.Add(xtpControlButton, 7, "Send") Set C = ReplyBar.Controls.Add(xtpControlButton, 8, "Send Later") Set C = ReplyBar.Controls.Add(xtpControlButton, 9, "Send All") Set C = ReplyBar.Controls.Add(xtpControlSplitButtonPopup, 10, "Acknowledge") Set C = ReplyBar.Controls.Add(xtpControlButton, 11, "CC") ReplyBar.ShowTextBelowIcons = True ReplyBar.SetIconSize 32, 32 ReplyBar.EnableDocking xtpFlagHideWrap Or xtpFlagHideWrap Set ReplyBar2 = CommandBars2.Add("Reply2", xtpBarTop) ReplyBar2.Customizable = False ReplyBar2.ContextMenuPresent = False ReplyBar2.ShowExpandButton = False ReplyBar2.ShowGripper = False Set C = ReplyBar2.Controls.Add(xtpControlButton, 12, "Re-Send") Set C = ReplyBar2.Controls.Add(xtpControlButton, 13, "Trash") ReplyBar2.ShowTextBelowIcons = True ReplyBar2.SetIconSize 32, 32 ReplyBar2.EnableDocking xtpFlagHideWrap Or xtpFlagHideWrap Dim Items() Items = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13) ImageManager.Icons.LoadBitmap App.Path & "\Icons\highclr.bmp", Items, xtpImageNormal CommandBars.Icons = ImageManager.Icons CommandBars2.Icons = ImageManager.Icons Call DockRightOf(ReplyBar2, ReplyBar) End Sub 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 Dim Left2 As Long Dim Top2 As Long Dim Right2 As Long Dim Bottom2 As Long CommandBars2.RecalcLayout BarOnLeft.GetWindowRect Left, Top, Right, Bottom BarToDock.GetWindowRect Left2, Top2, Right2, Bottom2 CommandBars2.DockToolBar BarToDock, Right, (Bottom + Top) / 2, BarOnLeft.Position End Sub ![]() |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
try
instead
CommandBars2.DockToolBar BarToDock, Right, (Bottom + Top) / 2, BarOnLeft.Position
CommandBars2.DockToolBar BarToDock, Right + 1000, (Bottom + Top) / 2, BarOnLeft.Position
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
JasonG ![]() Groupie ![]() Joined: 07 July 2008 Status: Offline Points: 76 |
![]() ![]() ![]() ![]() ![]() |
I see that this will offset the toolbar by 1000, however I am trying to get the width of the parent frame, and the width of replybar2, and use those measurements to place it all the way to the right. Using your method would not work if the form/frame was resized.
also, the offset doesnt even work... weird... |
|
![]() |
|
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1355 |
![]() ![]() ![]() ![]() ![]() |
I found this hack that seems to work...Add it after your current last ReplyBar.Controls.Add call.
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
![]() |
|
JasonG ![]() Groupie ![]() Joined: 07 July 2008 Status: Offline Points: 76 |
![]() ![]() ![]() ![]() ![]() |
You are the MAN!
|
|
![]() |
|
ijwelch ![]() Senior Member ![]() Joined: 20 June 2006 Status: Offline Points: 262 |
![]() ![]() ![]() ![]() ![]() |
Rewind a moment.
Your latest code shows: ReplyBar.EnableDocking xtpFlagHideWrap Or xtpFlagHideWrap and ReplyBar2.EnableDocking xtpFlagHideWrap Or xtpFlagHideWrap this should be ReplyBar.EnableDocking xtpFlagStretchedShared Or xtpFlagHideWrap ReplyBar2.EnableDocking xtpFlagStretchedShared Or xtpFlagHideWrap I pasted your original code into new form, added CommandsBars to form, added Picturebox and added Commandbars2 to picturebox. My suggestion then did exactly what you're looking for. Can you try again like I did above? I'll redo and post sample if required. |
|
![]() |
|
JasonG ![]() Groupie ![]() Joined: 07 July 2008 Status: Offline Points: 76 |
![]() ![]() ![]() ![]() ![]() |
The lines that said
ReplyBar.EnableDocking xtpFlagHideWrap Or xtpFlagHideWrap Were actually caught and fixed since I posted the code. I changed them to your reccomendation, and it works perfectly. Thanks again. |
|
![]() |
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 |