Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
UltraStatusBar: Handling EnabledChanged for Button
posted

I am removing some buttons from the form UI and replacing them with panels on an UltraStatusBar.  I have set the panels Style = Button.

For the Windows command buttons, I currently use

Private Sub cmdAdd_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAdd.EnabledChanged
    ' add code here.
End Sub

How do I get the same functionality with the button-style panels?

 TIA,

Dave

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi David,

    Since the user cannot enable or disable a button, you must be doing it in code. So you probably don't really need an event to tell you when the buttons are enabled or disabled - you could call the same code from wherever you are enabling and disabling the buttons. That's probably the easiest thing to do. 

    Of course, that might not always be the case. The buttons might be getting disabled as a result of some other code that you don't have access to.  There's no specific event for the enabling and disabling of a button on a status bar, though. So what you would have to do is trap the PropertyChanged event. This is a pretty generic event that fires for any property change, so it requires a bit of code to determine what changed. I think you could do something like this: 

     


            private void ultraStatusBar1_PropertyChanged(object sender, Infragistics.Win.PropertyChangedEventArgs e)
            {
                PropChangeInfo propChangeInfo = e.ChangeInfo.FindPropId(StatusBarPropertyIds.Enabled);
                if (propChangeInfo != null)
                {
                    UltraStatusPanel panel = propChangeInfo.Source as UltraStatusPanel;
                    if (panel != null &&
                        panel.Style == PanelStyle.Button)
                    {
                        // The enabled state of a button changed.
                    }
                }
            }

Children