Notifications
                
            
                Clear all
    
            
        [Closed] Checkbutton change state question- pressing checkbutton automatically?
Dec 14, 2013 5:33 am
                      Hi,
I have a question about running checkbutton,I want to run functions after changing the state of checkbutton,generally,we can do it like :
rollout only_test "" 
(
    checkbutton chk_test "Check Me!" 
    on chk_test changed state do 
    (
		print "Is changing state..."
    )
)
createDialog only_test 
So my question is ,how can I print “Is changing state…” without pressing the checkbutton but the codes can execute and checkbutton also change its state at the same time?
I tried this way,but only the state can change,no codes executed.
rollout only_test "" 
(
    checkbutton chk_test "Check Me!" 
    on chk_test changed state do 
    (
		print "Is changing state..."
	)
)
createDialog only_test 
only_test.chk_test.checked=true
or
rollout only_test "" 
(
    checkbutton chk_test "Check Me!" 
    on chk_test changed state do 
    (
		print "Is changing state..."
	)
)
createDialog only_test 
only_test.chk_test.checked=true
only_test.chk_test.checked=false
any suggestions?
                             2 Replies                        
                    Dec 14, 2013 5:33 am
                      only_test.chk_test.changed (val=(only_test.chk_test.checked=true))
or
only_test.chk_test.changed (val=(only_test.chk_test.checked=not only_test.chk_test.checked))
First one sets it to what you tell it; true or false.
Second one sets it to the opposite of whatever it’s current state is.
                        
                        1 Reply