Slider controller

Complete section 3

In the "RGA" iPhone view, rows 2 and 3 of section 3 are the slider type. We will recreate them in our "myRGA" iPhone view. Let's set up row 2 together. You should be able to complete row 3 on your own by the end of this tutorial.

Add two rows in section 3

Right click on the third "section" node in the iQuipment PC window, then select "add row" from the options. Repeat so that two new "row" nodes are added. Right click the "controller" node of the first new row. Select “add slider."

Right click the "title" node(1/ then enter "Start at(a.m.u.):" . In the example, the slider has a range from 30 to 500. Right click the "minimum" node and enter 30 then the "maximum" node and enter 500.

Connect the slider controller (of iPhone view) to the RGA example.exe (Windows app)

To connect this slider to to the "power" checkbox on RGA example.exe, right click the "source.dataName" node (4) then select "acquisition startingAMU" from the pull-down list.

Save, reload and test

SAVE myRGA.xml, reload the iPhone view, then test it on your iPhone. Now you should be able to slide the first slider of section 3 and see the "Starting at (a.mu.u.)" textfield (1) value changes.

How the "starting at (a.m.u.)" checkbox variable is exposed for MONITORING?

Open Form1.cs in the RGA Example VS project and double click the textBox (1, figure above). It should jump to the following code:
private void textBox_startingAMU_TextChanged(object sender, EventArgs e)
{
int value = Convert.ToInt32(textBox_startingAMU.Text);
INFOMATO.WCF.DataExchangeService.servicePostData("RGA", "acquisition startingAMU", value);

}

Every time the textbox name (named textBox_startingAMU) value changes, the above function is called. Since the value for a slider is an integer type, we need to convert the textBox text string to an integer by calling ConvertToInt32. We then call the function INFOMATO.WCF.DataExchangeService.servicePostData to inform iQuipment PC an update value for the "RGA" view, dataName "acquisition startingAMU."

How the "starting at (a.m.u.)" checkbox variable is exposed for REMOTE CONTROL?

Similar to the handling of the segments control, when you tap the slider on your iPhone, it will trigger the event INFOMATO.WCF.DataExchangeService.clientSetDataEvent which, in turn, calls up DataExchangeService_clientSetDataEvent for event handling.

void DataExchangeService_clientSetDataEvent(string viewName, string dataName, object dataValue)
{
if (viewName.ToLower() == "RGA".ToLower())
{
switch (dataName.ToLower())
{
...
case "acquisition startingamu":
this.UpdateTextGUIObject(this.textBox_startingAMU, dataValue.ToString());
break;
...
}
}
}

In the UpdateTextGUIObject(this.checkBox_power, (bool)dataValue) function call, we took care of Windows UI thread-safe issues when updating the textBox. Windows UI thread-safe issues are discussed in greater detail in the section on segment controllers.

Previous Lesson: Switch controller Table of Contents Next Lesson: Picker controller of numerical type