Hey there,
the ToggleButton is a two-state button that stays down when you push it and is supposed to come up when you push it again!
Or am I mistaken here?
When using a couple of ToggleButtons they do behave like that.
But a single ToggleButton stays pushed; it does not come back up by pushing it again.
I tried using JToggleButton and it is the same beahaviour so I am confused.
Is there any way to use a single ToggleButton like a switch?
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
'add a ToggleButton and a CommandButton
'when it is down
Public Sub Command1_Click()
ToggleButton1.Parent.setSelected(False) 'does not push the button
' ToggleButton1.Parent.doClick() 'does not push the button
' ToggleButton1.Parent.getModel.setPressed(False) 'does not push the button
' ToggleButton1.Parent.getModel.setSelected(False) 'does not push the button
End Sub
'when it is up
'Public Sub Command1_Click()
' ToggleButton1.Parent.setSelected(True) 'pushes the button
' ToggleButton1.Parent.doClick() 'pushes the button
' ToggleButton1.Parent.getModel.setPressed(True) 'does not push the button
' ToggleButton1.Parent.getModel.setSelected(True) 'pushes the button
'End Sub
|
Dani
Edit: I'd like to use the ToggleButton like a CheckBox. So I was trying to work with a hidden second ToggleButton but it seems like there is no way to get the first ToggleButton to appear 'unpushed' unless you actually click on second one!?