### Create Toggle Button

Example ToggleButton when selected, changes the background color from Red to Green and vv.
Uses library CSSUtils.
B4J Code Snippet
`Sub Process_Globals
...
Private Label1 As Label
Private ToggleButton1 As ToggleButton
End Sub`
`Sub AppStart (Form1 As Form, Args() As String)
...
ToggleButton1_SelectedChange(False)
End Sub`
`Sub ToggleButton1_SelectedChange(Selected As Boolean)
If Selected Then
' Button is selected, then change to red
CSSUtils.SetBackgroundColor(ToggleButton1, fx.Colors.Red)
ToggleButton1.Text = "OFF"
Label1.Text = "Button switched ON, press to turn OFF"
Else
' Button is NOT selected, then change to green
CSSUtils.SetBackgroundColor(ToggleButton1, fx.Colors.Green)
ToggleButton1.Text = "ON"
Label1.Text = "Button switched OFF, press to turn ON"
End If
End Sub`

Changed: , Category: Buttons, File: T6C167M1228.htm, ID: 1228