AdvancedHMI Software

General Category => Support Questions => Topic started by: Arvanoss on February 26, 2024, 08:02:15 AM

Title: Changing the Look of a Button
Post by: Arvanoss on February 26, 2024, 08:02:15 AM
Good Morning Everyone,

I have a working project that the operators are asking for a change.

I have several Basic Buttons that are Enabled and Disabled based on the machine condition.  The operators would like the Disabled state to be a different color as they are having trouble determining if the button is Disabled.

Is there some code I can add to the button to change the color when Disabled??

Thanks
Title: Re: Changing the Look of a Button
Post by: Archie on February 26, 2024, 10:01:06 AM
You can use the PLCAddressAhighlight property to change the color. Put the same address as used in PLCAddressEnabled
Title: Re: Changing the Look of a Button
Post by: Arvanoss on February 27, 2024, 06:32:16 AM
Thanks Archie,

I am using the PLCAddressHighlightX and PLCAddressSelectTextAlternate to display reactions to the button press, these are basic Jog and Run buttons.

Is there an option/method to add a "Enable Forecolor" and "Enable Backcolor"?

Thanks
Title: Re: Changing the Look of a Button
Post by: Archie on February 28, 2024, 02:37:34 PM
- In Solution Explorer expand down AdvancedHMIControls
- Exapand down the Controls folder
- Right Click BasicButton.vb and select View Code
- Go down to about line 405, just below #Region "Events"
- Add this code
Code: [Select]
    Protected Overrides Sub OnEnabledChanged(e As EventArgs)
        MyBase.OnEnabledChanged(e)

        If Not Me.Enabled Then
            Me.BackColor = Color.Black
        End If
    End Sub
Title: Re: Changing the Look of a Button
Post by: Arvanoss on March 04, 2024, 05:53:29 AM
Thank you Archie that works very well.