Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting name of widget in the action for that widget? and q on exclusive buttons.
#1
For my lighting control I want to have a series of command buttons on the page. Each one will specify the light to control. All of the button widgets are named the same as the Insteon device they control. I want to create one button widget with the OnClick action to be something like
GlobalVars::SetVariable(GVarTonguePC_CurrentLight, $(NameOfWidgetClicked))

How do I do the part in bold & red?


Also, what is the best way to show which button is selected? My intention is for only one to be active at a time so I need to have the buttons change state but also for them to be exclusive.
Reply
#2
I'm not sure I understand what you are looking for in the first part. For the second part, you have to just have each of them call SetImage() on itself and the other buttons to change the unpressed image to indicate active/inactive.
Dean Roddey
Explorans limites defectum
Reply
#3
For the first part, lets say I have 10 buttons. Actually, to make it more clear why I want this lets say I have 20. I'd like to create one button and then copy/paste it once the right OnClick action is setup. For each of the buttons I don't want to have to go in and edit the text, name, and OnClick event. I'd prefer to just edit the text and the widget name. I'd like to have the OnClick handler determine what value to set the global variable to based on the name of the widget that was clicked on.

For the 2nd Q, are you saying that I have to, from each button, make a call to every other button and do a SetImage on them? There is no way to group buttons for 'radio button like' effects? In that case, how do I write a function in CQC? I'd like each button to call the function and pass in their widget name to the function. Then the function would loop through all the buttons and if the name does not match the passed in name then it changes their image. Is this possible? It seems very un-programming friendly to have to copy the logic for each button so I'm assuming CQC has another method and I'm just not familar with it Smile
Reply
#4
There isn't currently any sort of radio button type of thing, because there's currently no grouping mechanism that could be used to group them together as exclusive, and there's no standard for what kind of radio button effect you would want so there would have to be some way to configure what you want to happen when one is set to the active one and when the others are made inactive. So for now you have to just do it manually if you want this sort of thing because we are waiting until there is a grouping mechanism (something that has many other uses and is general purpose) before trying to do it.

You can copy/paste commands easily enough. Select the event you've set up and want to copy, then use the Copy All button in the lower left. Then in the new one, just do Paste All.

But, easier than that generally is to just copy and paste the button itself and modify the bit that needs to be modified.

You can't create any logic outside of the widgets themselves, other than CML macros which don't have access to the widgets. CML is used to create complex 'behind the scenes' logic, for dealing with devices and such.
Dean Roddey
Explorans limites defectum
Reply
#5
I think this is in contrast to a common way of doing things in other languages. It's pretty common to set the "onClick" property of many buttons to the same event handling procedure, since the object that calls the procedure is passed to it as a parameter.

Some of us would find that much faster.
Reply
#6
But it's not a 'language' really. We have to be careful here because this has to be something that non-technical people can deal with. Before I did that with the action system I'd just do the work to allow you to invoke a CML macro that has access to the widgets probably.
Dean Roddey
Explorans limites defectum
Reply
#7
Dean Roddey Wrote:But it's not a 'language' really. We have to be careful here because this has to be something that non-technical people can deal with. Before I did that with the action system I'd just do the work to allow you to invoke a CML macro that has access to the widgets probably.
Ding! Ding! Ding! Smile

Have one action that is "Call CML" [class/procedure/macro] with the calling object and if appropriate the value as parameters would be very powerful and speedy for "power/; users.
Reply
#8
That would work great for me. I guess my issue here is that I'm programming/designing all day in my day job and then I try to apply those same concepts to CQC. Doing a copy paste of an 'object' and then tweaking the fields I care about does work, but it extends the amount of time required to get things working. And, with the keyboard accelerator keys not working (the confirmation dialog for example, you should not have to press ALT-Y and should be able to just hit Y for Yes) it just makes small roadblocks for me that definitely slow things down. If there is some way to expose CML handlers for buttons then I'd be all for that. I'll take the time to learn CML if it speeds up my development.

And if accelerator keys can be added for full coverage and have the existing ones fixed that'd be cool too! ("ALT-F, S" should not require me to hit enter, as another example Smile )
Reply
#9
You can already call CML. That's what the Macro target is for. They just don't have access to the interface widgets because that would be a lot of work to create all those interfaces.

What are you using Alt-F, S for? Is that to save? If so, then Ctrl-S does that. The designer's hot keys are documented in the Interface Design Guide document.
Dean Roddey
Explorans limites defectum
Reply
#10
Quote:And, with the keyboard accelerator keys not working (the confirmation dialog for example, you should not have to press ALT-Y and should be able to just hit Y for Yes) it just makes small roadblocks for me that definitely slow things down.

The reason that was done is that it works whether the cursor is in an entry field or multi-line editor or not. If you are in one of those, and you jsut press 'y' you'll just insert a y. It's just so that it's consistent, and always works.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Where's the Action Editor? Deane Johnson 4 1,809 07-30-2019, 02:50 PM
Last Post: Dean Roddey
  Video Widget znelbok 67 38,301 04-12-2017, 04:08 PM
Last Post: Dean Roddey
  An idea for a new widget Dean Roddey 5 4,223 03-13-2017, 02:47 PM
Last Post: potts.mike
  Web browser widget Trioxide 7 5,380 02-25-2017, 06:30 AM
Last Post: Trioxide
  Slider Widget potts.mike 1 2,074 04-19-2016, 04:59 PM
Last Post: Dean Roddey
  Field Incr/Decr Button Widget khill 15 7,695 05-17-2015, 01:04 PM
Last Post: dlmorgan999
  User Action on ZWave Keypad jkmonroe 18 8,313 04-04-2015, 05:46 AM
Last Post: jkmonroe
  How to put a pause in an Action list? Deane Johnson 10 4,981 11-30-2014, 11:22 AM
Last Post: Dean Roddey
  Overlay in an Overlay triggered by Widget Deane Johnson 4 3,729 11-09-2014, 10:29 AM
Last Post: Deane Johnson
  Trying CQC, need help with buttons Deane Johnson 45 12,703 11-05-2014, 03:13 PM
Last Post: Deane Johnson

Forum Jump:


Users browsing this thread: 1 Guest(s)