Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Changing .Enabled in design time
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Changing .Enabled in design time

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


Joined: 27 April 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mess Quote  Post ReplyReply Direct Link To This Post Topic: Changing .Enabled in design time
    Posted: 27 April 2009 at 2:14pm
Hi,
 
I'm trying to set the visibility and to enable and disable controls at run-time. I'm using Actions as described and have also read the sample code, but I don't seem to get it to work.
 
I created the action before everything else is created, and add this simple code when clicking a button:
 
    Dim Action As CommandBarAction
    Set Action = CommandBars.Actions(ID_HTML_EDIT)
 
When I change the Action.Enabled the properties changes as they should,  but the button doesn't gray out of disappear as I want visually. What seems to be the problem here?
 
Thank you,
Bjarne
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 28 April 2009 at 6:48am
Here's some code that I just test that works. You need a form with a CommandBars control (CommandBars1) and a standard VB6 CommandButton control (Command1):


Option Explicit

Private mo_TestAction As CommandBarAction

Private Sub Command1_Click()
   mo_TestAction.Enabled = Not mo_TestAction.Enabled
End Sub

Private Sub Form_Load()

   With Me.CommandBars1
      Set mo_TestAction = .Actions.Add(100, "Action Test", "This is a test", "Testing Testing", "Test")
     
      .Item(1).Controls.Add xtpControlButton, 100, ""
      .Item(1).Controls.Add xtpControlButton, 101, "Test2"
      .Item(1).Controls.Add xtpControlButton, 102, "Test3"
     
      .EnableActions
   End With
End Sub


The key for me was to define the Action before adding the controls.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Mess View Drop Down
Newbie
Newbie


Joined: 27 April 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mess Quote  Post ReplyReply Direct Link To This Post Posted: 28 April 2009 at 9:00am
Thank you. I got this to work by setting the status bar to Nothing and then instantiating a new StatusBar after that.
 
Thanks.
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.156 seconds.