Use global variables in widgets or conditionals

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
lchiocca
Posts: 69
Joined: 15 Aug 2013 10:11

Use global variables in widgets or conditionals

Post by lchiocca » 20 Sep 2013 08:47

Hi Martin,

I'm got myself a pretty nice widget to change profiles. It's basically got 4 buttons and in the middle the current state of which profile is active. That's all nice, but I'd rather have the current profile button highlighted instead of having a sloppy text in the middle. I've been playing around with the widget.xml and tried to inject global variables in there to see if I could change the color of a layer, but... nope. Doesn't work.

Now I've been thinking about what you'd need to change to be able to add variable support in each and every field of a widget. That's just an insane amount of work. And would clutter the UI a lot. So I thought, well actually what would be just as simple would be to have a condition on each layer, that would enable/disable the layer. With a simple condition, I could create a layer ontop of each of the four buttons with an alpha value, that would highlight the current active profile.

Would it be possible to get that? :).... please :)

Cheers
Loris

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Use global variables in widgets or conditionals

Post by Martin » 20 Sep 2013 10:04

Hi,

You can modify most settings of a widget or the elements on the widget using a script in a flow.
There is a hint about this feature at the end of the widget tutorial: http://automagic4android.com/en/help/cr ... tom-widget

I highly recommend to use the Function-button to select the function setWidgetElementProperty. This will show a dialog to select the widget, element and the property to modify. I also highly recommend to give the elements and the widget itself a good name before you start writing scripts.

Regards,
Martin

lchiocca
Posts: 69
Joined: 15 Aug 2013 10:11

Re: Use global variables in widgets or conditionals

Post by lchiocca » 20 Sep 2013 13:51

Wow! Didn't know that existed! Thanks! That's even better!

Locked