InstantX toggle unit not picking up custom ON and OFF labels

James Sentman james at sentman.com
Sun Nov 2 14:55:26 EST 2014


You're going to need to pull out the onLabel and off label separately and insert them separately. So add these 2 lines to the code just above there where it pulls out all the other variables from the record:

		set onLabel to (xtOnLabel of MyUnitRecord) as text
		set offLabel to (xtOffLabel of MyUnitRecord) as text


and then change the replace line to something like:

		ReplacePageTag {{"calculatedwidth", MyColumnWidth}, {"togglewidth", ToggleWidth}, {"thumbwidth", ThumbWidth}, {"background", background}, {"name", DisplayName}, {"unitid", TheID}, {"valuedisplay", TheLabel}, {"toggled", TheToggle}, {"onlabel", onLabel}, {"offlabel", offLabel}}


and then in the .x10 file instead of using the [valuedisplay] to get the current label, use [onlabel] and [offlabel] to be replaced by the ones for the appropriate label. This should work UNLESS you're changing the labels dynamically in on/off scripts, in which case it may not pick up on the changes and update before the page is returned. But if they are just set for the unit that should work.


> On Nov 2, 2014, at 2:40 PM, Rob Lewis <rob at whidbey.com> wrote:
> 
> Ta da! 
> 
> That fixed the label display; however after toggling the unit I have to reload the InstantX page to get the new status to display. Any way to make it automatically update? 
> 
> Thanks! 
> 

Thanks,
 	James


James Sentman                       http://sentman.com		http://MacHomeAutomation.com





More information about the XTensionList mailing list