Deactivate a activated Button when a other one gets activated

Options
treynterrio
treynterrio Member Posts: 64 Member

Hi, when for example Button 2 is activated and I activate Button 5 the second one should be deactivated and so on.

is there another way to do this? because since I'm using this code I've many problems with the functions of my script.

on init
declare $i
declare ui_button $button0
declare ui_button $button1
declare ui_button $button2
declare ui_button $button3
declare ui_button $button4
declare %buttonIds[5] := (get_ui_id($button0), get_ui_id($button1), get_ui_id($button2), get_ui_id($button3), get_ui_id($button4))
declare const $buttonIds__SIZE := 5
end on

on ui_control($button0)
$i := 0
while ($i<num_elements(%buttonIds))
set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0)
inc($i)
end while
$button0 := 1
end on

on ui_control($button1)
$i := 0
while ($i<num_elements(%buttonIds))
set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0)
inc($i)
end while
$button1 := 1
end on 

on ui_control($button2)
........

Comments

  • corbo-billy
    corbo-billy Member Posts: 83 Helper
    Options

    What type of problems are you experiencing ?

    This code written just above seems to be suitable.

Back To Top