Assign Toolbars to individual Containers |
Post Reply |
Author | |
FLEXform
Newbie Joined: 15 June 2006 Status: Offline Points: 2 |
Post Options
Thanks(0)
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, |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
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.
|
|
mjdgreen
Newbie Joined: 29 June 2006 Location: United Kingdom Status: Offline Points: 2 |
Post Options
Thanks(0)
|
So unless I build the bars dynamically I will get duplicate IDs between the two (or more) resultant bars.
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
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 |
|
mjdgreen
Newbie Joined: 29 June 2006 Location: United Kingdom Status: Offline Points: 2 |
Post Options
Thanks(0)
|
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.
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
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. |
|
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 |