Hi,
I'm trying to make an interface with 2 windows. In this case option_1 and option_2. The goal is when I select option_1, option_2 disappears and vice versa. As long as I have the same number of elements in the arrays for each window it works fine. The problem starts when i add an element to one of the arrays. Everything works fine but when I click on option_2 it says control id was not declared. I can't understand what I'm doing wrong.
At this point "polypx" on vi-control told me that the while loops are assuming they are the same size. How can i make them assume the real size of each array? Is it possible?
on init
set_ui_height(30)
make_perfview
message("")
declare %option_1[5]
declare %option_2[6]
declare $i
{-----------Option 1-----------}
declare ui_switch $swi_option1
move_control($swi_option1,5,1)
declare ui_switch $swi_option2
move_control($swi_option2,6,1)
declare ui_switch $swi_test1
move_control($swi_test1,1,1)
declare ui_switch $swi_test2
move_control($swi_test2,1,2)
declare ui_switch $swi_test3
move_control($swi_test3,1,3)
declare ui_switch $swi_test4
move_control($swi_test4,1,4)
declare ui_switch $swi_test5
move_control($swi_test5,1,5)
%option_1[0] := get_ui_id($swi_test1)
%option_1[1] := get_ui_id($swi_test2)
%option_1[2] := get_ui_id($swi_test3)
%option_1[3] := get_ui_id($swi_test4)
%option_1[4] := get_ui_id($swi_test5)
{-----------Option 2-----------}
declare ui_switch $swi_test6
move_control($swi_test6,2,1)
declare ui_switch $swi_test7
move_control($swi_test7,2,2)
declare ui_switch $swi_test8
move_control($swi_test8,2,3)
declare ui_switch $swi_test9
move_control($swi_test9,2,4)
declare ui_switch $swi_test10
move_control($swi_test10,2,5)
declare ui_switch $swi_test11
move_control($swi_test11,2,6)
%option_2[0] := get_ui_id($swi_test6)
%option_2[1] := get_ui_id($swi_test7)
%option_2[2] := get_ui_id($swi_test8)
%option_2[3] := get_ui_id($swi_test9)
%option_2[4] := get_ui_id($swi_test10)
%option_2[5] := get_ui_id($swi_test11)
end on
function show_option_1
$i := 0
while ($i<num_elements(%option_1))
set_control_par(%option_2[$i],$CONTROL_PAR_HIDE,$HIDE_WHOLE_CONTROL)
set_control_par(%option_1[$i],$CONTROL_PAR_HIDE,$HIDE_PART_NOTHING)
$swi_option2 := 0
inc($i)
end while
end function
function show_option_2
$i := 0
while ($i<num_elements(%option_2))
set_control_par(%option_1[$i],$CONTROL_PAR_HIDE,$HIDE_WHOLE_CONTROL)
set_control_par(%option_2[$i],$CONTROL_PAR_HIDE,$HIDE_PART_NOTHING)
$swi_option1 := 0
inc($i)
end while
end function
on ui_control($swi_option1)
call show_option_1
end on
on ui_control($swi_option2)
call show_option_2
end on