General Community > User Showcase

System Information

(1/4) > >>

iostream212:
I recently added a system information button to my setup. It is pretty flexible and an easy way to log events to your touch screen.
First I created a global variable to store system information to. In this example the variable is called "strSystemInfo".
Next I added a boolean control to my top level screen. The boolean evaluates the length of the 'strSystemInfo' variable to determine if to show the 'information available' icon or not.

No information:



Information available:



Next I created a few popups. One for information available and the other for no information available.

No information pop up:



Information popup:



Now to wire it all together:

Control press event for the information boolean:

--- Code: ---if (vars.strSystemInfo.length > 0)
{
TopTouchScreen.ShowPopup(@"iPhone Example - System Information");
}
else
{
TopTouchScreen.ShowPopup(@"iPhone Example - System No Information");
}

--- End code ---

Code for the information available popup. 'this' refers to a page list control, and this script adds items to the control from a delimited string of system information. I used ";" as my field delimiter.


--- Code: ---strAlert = vars.strSystemInfo;
Alert = New Array();
Alert = strAlert.Split( ";" );
if (Alert.Length > 1)
{
this.BeginUpdate();
for (i=1; i < Alert.Length; i++)
this.Add( Alert[i], i );
this.EndUpdate();
}

--- End code ---

To handle removing alerts I added a button with the following press event. plSystemInfo is the name of my page list:


--- Code: ---if (TouchScreen.plSystemInfo.SelectedIndex >= 0)
{
strAlerts = TouchScreen.plSystemInfo.SelectedText;
TouchScreen.plSystemInfo.Remove(TouchScreen.plSystemInfo.SelectedIndex);
strSystemAlerts = vars.strSystemInfo.Trim();
vars.strSystemInfo = strSystemAlerts.Replace((";" + strAlerts), "");
}

--- End code ---

With this in place I can easily add system alerts to my touch screen.  In any script I just add:
vars.strSystemInfo = vars.strSystemInfo + ";" + "New alert";

John Hughes:
Great, thanks for the post!

It looks like you are a pro at j9script. :)

You should also specify the strSystemInfo global variable as an initial variable in the global variable driver settings so that the script doesn't throw an error if the variable has not yet been assigned a value.

iostream212:

--- Quote from: John Hughes on July 18, 2012, 02:48:48 pm ---Great, thanks for the post!

It looks like you are a pro at j9script. :)

You should also specify the strSystemInfo global variable as an initial variable in the global variable driver settings so that the script doesn't throw an error if the variable has not yet been assigned a value.

--- End quote ---

Good point! That's right people: initialize your variables! :D

Sent from my Galaxy Nexus using Tapatalk 2

Frunple:
Wouldn't the Google Calendar driver be easier to use for this?

iostream212:

--- Quote from: Frunple on July 20, 2012, 05:03:03 am ---Wouldn't the Google Calendar driver be easier to use for this?
--- End quote ---
There is no method in that driver to add calendar entries. It would be a good idea to use that driver if it could add them.  That way your alerts would be visible independent of the elve server. If that feature was added I would change to that driver. Probably setup a dedicated automation Gmail acct too.

Sent from my Galaxy Nexus using Tapatalk 2

Navigation

[0] Message Index

[#] Next page

Go to full version