Author Topic: Scripting question - Trying to display violated zones in a list control  (Read 2145 times)

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
I am trying to modify the script that listed all security zones from the Festive touchscreen example. I want to add a button to filter by normal and violated zones.  Changing a few things from the original script I am left with this:
Code: [Select]
try
{
Touchscreen.lstZoneNames.BeginUpdate();

// Set 'device' to the security device name.
device = security;

// Clear the zones list
Touchscreen.lstZoneNames.Clear();

// Get the zone names array from the selected security device.
names = security.ZoneNames;

// Loop over all the zone names and add the ones that aren't blank to the zones list.
for (zoneID=1; zoneID<names.Length; zoneID++)
{
// Get the name
name = names[zoneID];

// If the zone is violated
if ( ELKM1.ZonePhysicalStatuses[zoneID] == 2 )
{
// Add the name to the list, with the zone id as the value.
Touchscreen.lstZoneNames.Add( name + " - { security.ZonePhysicalStatusTexts[" + zoneID + "] }", zoneID);
}
}
}
finally
{
Touchscreen.lstZoneNames.EndUpdate();
}

My issue is that this takes ~2-3 seconds to execute while the original script is more instant. Is there a more efficient way for me to script this?
Thanks!
I always wanted to be somebody. In retrospect, I think I should have been more specific.

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2851
    • View Profile
    • Codecore Technologies
Re: Scripting question - Trying to display violated zones in a list control
« Reply #1 on: January 06, 2012, 09:52:28 pm »
Try changing the following line:

if ( ELKM1.ZonePhysicalStatuses[zoneID] == 2 )

to

if ( security.ZonePhysicalStatuses[zoneID] == 2 )

John Hughes
Codecore Technologies

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Scripting question - Trying to display violated zones in a list control
« Reply #2 on: January 07, 2012, 01:12:39 pm »
Thanks John. That shaved off about a second. Better than what it was. :)

Sent from my SCH-I510 using Tapatalk
I always wanted to be somebody. In retrospect, I think I should have been more specific.

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2851
    • View Profile
    • Codecore Technologies
Re: Scripting question - Trying to display violated zones in a list control
« Reply #3 on: January 07, 2012, 02:48:14 pm »
Is it faster after repeated refreshes?  Once the values are cached in the touch screen viewer, it should be quicker.
John Hughes
Codecore Technologies

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Scripting question - Trying to display violated zones in a list control
« Reply #4 on: January 15, 2012, 10:43:50 pm »
Seems to be about the same even after repeated refreshes. I don't notice it too much anymore. Been in use for a few weeks and I am used to it now. Thanks!

Sent from my SCH-I510 using Tapatalk
I always wanted to be somebody. In retrospect, I think I should have been more specific.

Annaleelooms

  • Jr. Member
  • **
  • Posts: 38
    • View Profile
    • Игрушки для взрослых
Scripting question Trying to display violated zones in a list co
« Reply #5 on: April 19, 2017, 06:12:38 pm »
yeah that, my bad. I mistyped. Thanks for the help everyone.

- кстати (немного не по теме) сегодня наткнулась на хороший сайт, который возвращает часть средств от покупок в интернете!
Всем рекомендую http://epngo.bz/cashback_index/130rx1

GeorgeHarthups

  • Hero Member
  • *****
  • Posts: 2580
    • View Profile
4gua7pei
« Reply #6 on: August 29, 2017, 09:07:20 am »
https://bitbucket.org/snippets/scottiedurrett1999f1/4LAz7x/
https://bitbucket.org/snippets/merrilljbt1981x1/pLq94r/
 
OS : Windows 7 32bit , Windows 7 64bit , Windows 8.1 32bit , Windows 8.1 64bit , Windows 10 (Note) Please install APP Center first before install this utility.
https://bitbucket.org/snippets/williepvr1979l2/zLqBdq/
https://bitbucket.org/snippets/harveybeamer1966r7/X8Lg8A/
 
It's located in Developer/Applications/Extras and it's Dec 8, 2014 Preview is awesome for a number of reasons, and writer Dave Winer points out that it also makes a great paint program. With the addition of features such as Symbols and Constraints, Affinity With a professional pedigree forged on Mac, and matched step for step on I'm seeking a Mac app for creating basic flowcharts and similar diagrams.
https://bitbucket.org/snippets/trumanujq1974w5/5ELAR5/
https://bitbucket.org/snippets/trenthdz1998r9/qEk5jR/
 
WinXP/Vista/7/8/10 or Later PDF To BMP - 24 Bit High Quality. Ultimate Office Solution Package! This Post Was Last Updated On: February 7, 2015 By Author: Admin.
http://www.codecoretechnologies.com/community/index.php?topic=2602.new#new
http://missourivolunteermovement.com/forum/index.php?topic=743810.new#new
http://wesele-kielce.com.pl/showthread.php?tid=8&pid=693028#pid693028
http://www.ibookdb.net/forums/index.php/topic,652248.new.html#new
http://forum.gipnoclub.ru/index.php?topic=515692.new#new
 
http://google.com/q=hle6tr7d