Getting control data for variables

Moderator: Moderator Group

Getting control data for variables

Postby claude.rivet » Mon Mar 17, 2014 4:17 pm

Good day fine cooluxians, I was wondering, is it possible to get information about "current" control with WD (pro)?

I use a custom script button, when it is pressed a script is executed, my goal would be to copy that script and paste it in the 119 other buttons, as is and the script would work without modifying the code. My only problem at this point is I don't seem to be able to retrieve the ID of the current button (the button into which the script is located), if I could a bunch of stuff could be automated and the copy paste would work.

Why? This way I could add buttons to my project without having to copy/paste from another button and spend time changing the references in the script, I could change the code once and just copy/paste it to all other button rather than tediously going in each button and adapt it.

Code: Select all
VGetCurrentControlID, currentbutton
VMultiply,textbox1,currentbutton,2
VSubstract,textbox1,textbox1,1
VMultiply,textbox2, currentbutton,2


SO, if I paste that code in ANY button, as long as I make sure the ID is good it will work and call the right elements when executing, for button ID 1 the textbox containing the value inputed by the user will be ID 1 and textbox containing the second value inputed by the user will be ID 2, for button 300, the textbox IDs will be 599 and 600 without ever having to change anything in the script, all I have to so is make sure the button and textboxes are ID'd correctly.

Now there is probably a way to do that (or equivalent) already and I just have to know how but I looked into nodes and script command list and I could not find what I was looking for.

Anyone here did this or equivalent or know it's not possible? Please share

Thank you very much for your help, these forums have proved very helpful.
regards
claude.rivet
 
Posts: 67
Joined: Tue Aug 07, 2012 5:40 pm

Re: Getting control data for variables

Postby claude.rivet » Mon Mar 17, 2014 5:14 pm

I just read the following topic:

viewtopic.php?f=80&t=3282

Seriously, that easy? I would just write:

Code: Select all
Vint,currentbutton,MyId
VMultiply,textbox1,MyId,2
VSubstract,textbox1,textbox1,1
VMultiply,textbox2,MyId,2


To get the button ID and deduct my the textboxes containing the values inputed by the user from the button ID?

Wow, very nice if it's the case.
claude.rivet
 
Posts: 67
Joined: Tue Aug 07, 2012 5:40 pm

Re: Getting control data for variables

Postby malkuth23 » Tue Mar 18, 2014 4:25 am

It is the case!

I very useful feature added to Widget. Made my life a lot easier :)
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 354
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 18 guests