Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Assign Toolbars to individual Containers
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Assign Toolbars to individual Containers

 Post Reply Post Reply
Author
Message
FLEXform View Drop Down
Newbie
Newbie


Joined: 15 June 2006
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote FLEXform Quote  Post ReplyReply Direct Link To This Post Topic: Assign Toolbars to individual Containers
    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,
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
mjdgreen View Drop Down
Newbie
Newbie
Avatar

Joined: 29 June 2006
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjdgreen Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mjdgreen View Drop Down
Newbie
Newbie
Avatar

Joined: 29 June 2006
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjdgreen Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.066 seconds.