Android Question 3-state Toggle Button

GMan

Well-Known Member
Licensed User
Longtime User
Yahoo Folks,
is it possible to create a 3-state toggle button, like a checkbox which has also 3 states (1. Checked, 2. Unchecked, 3. filled with some gray color) ?
Could work like a "switch knob" with positions 1,2,3 or so....
 

derez

Expert
Licensed User
Longtime User
Yahoo Folks,
is it possible to create a 3-state toggle button, like a checkbox which has also 3 states (1. Checked, 2. Unchecked, 3. filled with some gray color) ?
Could work like a "switch knob" with positions 1,2,3 or so....
For button, you can use the following with any button:
B4X:
Sub btn_click
Select btn.text
    Case  "first"
        btn.Text = "second"
        'do things
    Case "second"
        btn.Text = "third"
        'do things
    Case "third"
        btn.Text = "first"
        'do things
End Select
End Sub
for checkbox - you'll need to create a class, it is possible.
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
Thx 4 u reply David, but this i know and use it this time with a picturebox - because i want to have visual feedback about the button state, so off , green and (maybe) yellow.
I like to have a train signal displayed, which (in standard version) has a green, a red and a yellow light and (each means something other) want that color status displayd in the button like a toggle button.
so i will try a picturebox with the code and change the picture depending on the 1st,2nd or 3rd click....
 
Upvote 0
Top