General Category > Support Questions

Changing the Look of a Button

(1/1)

Arvanoss:
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

Archie:
You can use the PLCAddressAhighlight property to change the color. Put the same address as used in PLCAddressEnabled

Arvanoss:
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

Archie:
- 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: ---    Protected Overrides Sub OnEnabledChanged(e As EventArgs)
        MyBase.OnEnabledChanged(e)

        If Not Me.Enabled Then
            Me.BackColor = Color.Black
        End If
    End Sub

--- End code ---

Arvanoss:
Thank you Archie that works very well.

Navigation

[0] Message Index

Go to full version