Print Page | Close Window

Actions not working

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=6373
Printed Date: 01 November 2024 at 12:34am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Actions not working
Posted By: WayneB
Subject: Actions not working
Date 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




Replies:
Posted By: WayneB
Date 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



Posted By: nvierros
Date 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.
 
:)


Posted By: WayneB
Date 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:






Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net