Multiple Load/Save Buttons

Andrew Finch
Andrew Finch Member Posts: 17 Newcomer

Hi all,

I am working on a project that requires multiple (separate) load/save buttons for different controls on a GUI. So far I have worked this out:

on init
  declare $count
  declare ui_button $Load
  declare ui_button $Savea
  declare %preset[2]
  declare const $MAIN_PAGE := 2
  declare %main_view_id[$MAIN_PAGE]
  declare $load_arr_id
  $load_arr_id := -1
  declare $save_arr_id
  $save_arr_id := -1
  declare ui_slider $knob (0,1000000)
	declare ui_slider $knob2 (0,1000000)   
  make_persistent ($knob)
end on

on ui_control ($knob)  
  %preset[0] := $knob
end on

on ui_control ($knob2)  
  %preset[1] := $knob2
end on

on ui_control ($Load)
  $load_arr_id := load_array(%preset,0)
end on

on ui_control ($Save)
  $save_arr_id := save_array(%preset,0)
end on

on async_complete
  if ($NI_ASYNC_ID = $load_arr_id)
    $load_arr_id := -1
    $Load := 0
    if ($NI_ASYNC_EXIT_STATUS = 1)
      $knob := %preset[0]
			$knob2 := %preset[1]
    end if
  end if
  if ($NI_ASYNC_ID = $save_arr_id)
    $save_arr_id := -1
    $Save := 0
  end if
end on

At the moment this creates a load and save button for two sliders but I essentially want to incorporate another set of load/save buttons to independently load/save two more sliders, how do I go about adding this into the code I have worked out so far? Thanks in advance!


Back To Top