Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Actions not working
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Actions not working

 Post Reply Post Reply
Author
Message
WayneB View Drop Down
Newbie
Newbie
Avatar

Joined: 11 February 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote WayneB Quote  Post ReplyReply Direct Link To This Post Topic: Actions not working
    Posted: 11 February 2007 at 7:22pm
I am using the following code to create one Action for each Control that I created in the designer. This code runs, however when I handle the Execute event (shown below) nothing happens.

Also, there is no option in the Designer to "Enable Actions", I have looked everywhere...


Private Sub MDIForm_Load()
   
    CommandBarsGlobalSettings.App = VB.App
   
    With CommandBars
       
        .LoadDesignerBars VB.App.Path & "\MainWindow.xcb"
       
        .EnableActions
       
        .EnableCustomization False
       
        .Icons = ImageManager1.Icons
               
        With .ShowTabWorkspace(True)
            .EnableGroups
        End With
       
        With .StatusBar
            .Visible = True
            With .AddPane(0)
                .Style = SBPS_STRETCH
                .Text = "Test!"
            End With
            .AddPane ID_INDICATOR_CAPS
            .AddPane ID_INDICATOR_NUM
            .AddPane ID_INDICATOR_SCRL
        End With
       
    End With
   
    AddCommandActions

End Sub

Private Sub AddCommandActions()
   
    Dim colTool As XtremeCommandBars.CommandBarControls, oTool As XtremeCommandBars.CommandBarControl
    Dim colAction As XtremeCommandBars.CommandBarActions
   
    With CommandBars
        Set colTool = .DesignerControls
        Set colAction = .Actions
    End With
   
    For Each oTool In colTool
       
        With oTool
            colAction.Add oTool.Id, oTool.Caption, oTool.ToolTipText, oTool.DescriptionText, oTool.Category
        End With
       
    Next
   
End Sub


Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
   
    Debug.Print "MainWindowMDI.CommandBars_Execute " & Control.Caption
   
    Select Case Control.Id
    Case ID_WINDOW_DBEX, ID_WINDOW_QUERYRESULTS
       ' NOTE: This doesn't do ANYTHING!
        With CommandBars.Actions(Control.Id)
            .Checked = True
        End With
      
    End Select
End Sub

Back to Top
WayneB View Drop Down
Newbie
Newbie
Avatar

Joined: 11 February 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote WayneB Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2007 at 7:31pm
The only time that Actions work for me is when I add the Actions BEFORE loading the designer xcb file.

This also works:


With CommandBars
       
        .LoadDesignerBars VB.App.Path & "\MainWindow.xcb"
       
        .EnableActions
       
        AddCommandActions ' See previous post for code of this procedure.
       
        .LoadDesignerBars VB.App.Path & "\MainWindow.xcb"
    ...
End Sub

Back to Top
nvierros View Drop Down
Groupie
Groupie
Avatar

Joined: 02 July 2006
Location: Australia
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote nvierros Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2007 at 11:57pm
You could always just enable Actions within the commandbars design studio, that way you dont need to call .enableactions.
 
You just have to add the action to the collections..
 
In the design studio, click on an item then in the propertygrid select, EnableActions.
 
:)
Back to Top
WayneB View Drop Down
Newbie
Newbie
Avatar

Joined: 11 February 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote WayneB Quote  Post ReplyReply Direct Link To This Post Posted: 12 February 2007 at 12:29am
Ahh, I see it now. I could not find the "Enable Actions" hyperlink before. Thank you.

May I ask why that is not a property of the CommandBars control? I expected it to be found under the Commandbars->Settings dialog since it affects the entire collection of controls.

If anyone else has trouble finding it, here's a screenshot for you:



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.187 seconds.