Author Topic: LiquidUI: Set a Group of Variables  (Read 6855 times)

chirag.amin@guixt.com

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 34
    • View Profile
LiquidUI: Set a Group of Variables
« on: February 10, 2016, 03:57:50 PM »
The set command can be used to set more than one variable. If we name all the variables with a naming convention in a script, then the set command can set all the variables in one simple line. In this example, the variables all begin with "z_". When the set command is used, the first parameter passed is "V[z_*]". This will set all variables that begin with "z_". This is very useful for clearing variables at the end of a script.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Author: Synactive, Inc. [1065 E. Hillsdale Blvd, Foster City, CA, 94404, USA]
// Email: support@guixt.com; sales@guixt.com;
// Contact: 650.341.3310
// Version: 1.0.0.0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Clear the screen
clearscreen();

// Have 5 inputfields with the variable name all starting with "z_"
inputfield([0,0], "Variable_1", [0,12], {"size":15,"name":"z_var1"});
inputfield([1,0], "Variable_2", [1,12], {"size":15,"name":"z_var2"});
inputfield([2,0], "Variable_3", [2,12], {"size":15,"name":"z_var3"});
inputfield([3,0], "Variable_4", [3,12], {"size":15,"name":"z_var4"});
inputfield([4,0], "Variable_5", [4,12], {"size":15,"name":"z_var5"});

// a button to load the variables
pushbutton([0,35], "Load Variables ", {"process":loadVar});
// a button to clear the variables
pushbutton([1,35], "Clear Variables", {"process":clearVar});

// function sets variables to "GROUP-SET"
function loadVar(){
   set("V[z_*", "GROUP-SET");
}
// function clears variables
function clearVar(){
   set("V[z_*", "");
}

See attachments..