Assign Toolbars to individual Containers
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=4418
Printed Date: 05 February 2025 at 12:50pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Assign Toolbars to individual Containers
Posted By: FLEXform
Subject: Assign Toolbars to individual Containers
Date Posted: 15 June 2006 at 5:28pm
The documentation mentions that you can assign toolbars to windows, can you assign one toolbar to one window(Container or picturebox).
For example we have three containers(pictureboxes) and would like to attach one toolbar per container. Is this possible.
Thanks,
|
Replies:
Posted By: jcollier
Date Posted: 19 June 2006 at 11:57am
I did this using a Frame in VB6. In the IDE I just placed 2 frames on my form, and put a CommandBar in each frame. Now the ToolBars display wherever I place the frames on the form.
|
Posted By: mjdgreen
Date Posted: 29 June 2006 at 6:06pm
So unless I build the bars dynamically I will get duplicate IDs between the two (or more) resultant bars.
|
Posted By: jcollier
Date Posted: 30 June 2006 at 3:11pm
I did it with the following code:
Dim Bar As CommandBar
'create project toolbar Set Bar = CommandBarsProject.Add("ClockInProjects", xtpBarTop)
With Bar.Controls .Add xtpControlButton, ID_CLOCKINPROJECTS, "Clock In" .Add xtpControlButton, ID_BACK, "View Pay Hours" .Add xtpControlButton, ID_BREAK, "Break" .Add xtpControlButton, ID_CLOSEWINDOW, "Close" End With
Bar.Closeable = False Bar.EnableDocking xtpFlagHideWrap Bar.ModifyStyle XTP_CBRS_GRIPPER, 0
With CommandBarsProject.Options .LargeIcons = True .ShowExpandButtonAlways = False .UseFadedIcons = False End With
CommandBarsProject.ActiveMenuBar.Visible = False CommandBarsProject.Icons = frmParent.imCommandBar.Icons
'create payroll toolbar Set Bar = CommandBarsClock.Add("ClockInPayroll", xtpBarTop) With Bar.Controls .Add xtpControlButton, ID_CLOCKIN, "Clock In" .Add xtpControlButton, ID_CLOCKOUT, "Clock Out" .Add xtpControlButton, ID_BACK, "View Project Hours" .Add xtpControlButton, ID_CLOSEWINDOW, "Close" End With
Bar.Closeable = False Bar.EnableDocking xtpFlagHideWrap Bar.ModifyStyle XTP_CBRS_GRIPPER, 0
With CommandBarsClock.Options .LargeIcons = True .ShowExpandButtonAlways = False .UseFadedIcons = False End With
CommandBarsClock.ActiveMenuBar.Visible = False CommandBarsClock.Icons = frmParent.imCommandBar.Icons
|
Posted By: mjdgreen
Date Posted: 30 June 2006 at 4:09pm
How does this solve the original problem of having toolbars from the same control appear in different containers. If you use the Design time editor to create the toolbars so that no separate file is needed then all the toolbars created must appear within the same container. If I want toolbars to appear in separate containers then I need to have separate controls in each container. Now the problem is I may have the "same" control appear in both toolbars. In this case unless I create the toolbars at run-time and co-ordinate the IDs myself the same control will have different IDs in the different controls. Also from a code point of view I have to deal with the same control in two different places. There is a method AttachToWindow but I cannot get this to work for individual toolbars.
|
Posted By: jcollier
Date Posted: 30 June 2006 at 4:17pm
I'm not sure how to do it using the design time editor with only one control. I used 2 frames and 2 CommandBars and created the buttons at runtime with the posted code and it's working out for what I need it to do.
Sorry I couldn't be more help.
|
|