Notifications
Clear all

[Closed] checkbutton.state trouble

Hi All,
I’m trying to have 2 x checkbuttons in which they have opposite states if one of them is true, but when I do this, I am then unable to un-tick one of these checkbuttons!
Am I missing some logic here…?..! I seem to be stuck in a loop!

checkbutton ram_player_a “RAM Player Ch.A” cheked:false align:#left across:2
checkbutton ram_player_b “RAM Player Ch.B” cheked:false align:#left

  on ram_player_a changed state do
  (
      ram_player_a.state = not ram_player_b.state
  )
  on ram_player_b changed state do
  (
      ram_player_b.state = not ram_player_a.state
  )

Thx,
Mike

3 Replies
 PEN

You are trying to set the state of the button that you are pushing and you have checked spelt cheked in the control line.

rollout test "" width:300
(
	checkbutton ram_player_a "RAM Player Ch.A" checked:true align:#left across:2
	checkbutton ram_player_b "RAM Player Ch.B" checked:false align:#left

	on ram_player_a changed state do
	(
		ram_player_b.state = not state
	)
	on ram_player_b changed state do
	(
		ram_player_a.state = not state
	)
	
)
createDialog test

Thanks Paul, knew I was doing something stupid!

 PEN

Just as a side note, if you are going to post code try to use the code tags and post code that can be tested without having to write more. Just makes it easier for people to help you.