Page 1 of 1

Create flexible WDCustomScript buttons

PostPosted: Tue Jul 12, 2016 10:55 am
by hpgec
Hi,

I am currently working with Widget Designer to create a new interface - let's call it project overview. And I'd like to have different buttons, that load different projects on click. This doesn't seem like a big problem yet.

But:
The projects are supposed to change every view months. So I would like to create another interface to add new projects to projects overview. Therefor I would like to have like a form, where the supposed button name can be inserted, as well as the project path. By submitting this, a new button should be automatically added to the project overview, with the delivered values.
So I want to program one button to create other buttons.
Is that possible in any way?


Thank you for any help!!

Re: Create flexible WDCustomScript buttons

PostPosted: Tue Jul 26, 2016 8:46 am
by Janina Baltaziewicz
Hi there,


unfortunately, there is no command like "CreateCustomScript", the only possibility of achieving a (at least visually) similar behaviour would be creating some buttons beforehand and hide/unhide those.
How to use that depends a bit on your setup, but this seems to be the only way at the moment.
The values can be delivered via variables.


Best regards,

Janina

Re: Create flexible WDCustomScript buttons

PostPosted: Wed Jul 27, 2016 5:48 am
by malkuth23
Oddly enough, there actually is a way to make a Custom Script button. It is just undocumented and hidden from search for some reason :)

"WDControlCreate,Type,X,Y"
Type = "Label","CustomScript","Fader","Image","Dropdown","Wheel","Encoder"

Still would not solve your problem though... Because I don't think you can modify the script inside a button.
Maybe you could do some sort of god-awful node based variable hodge podge from hell involving the CSbutton ID number, but I would just tell everyone it is impossible because it will be pure suffering.

When I have had to do something like this in the past, I got inspired from old video games... You get X number of save slots. You can save in any of these, but that is your limit. If you want to save over an old one feel free, but you can't have any more than X. It is still a lot of programming.

Also keep in mind that when you run a command to save your widget, all subsequent and current running scripts are CANCELLED. It is actually a good way to cancel a script loop or long Wdwait commands, but you have to make sure saving is your final command in a chain.

Re: Create flexible WDCustomScript buttons

PostPosted: Wed Jul 27, 2016 12:51 pm
by Janina Baltaziewicz
Hmmm... that seems to be one of the things that got removed because of some reason (probably because that command was responsible for other problems), but stays usable. We normally implement that for imports from older revisions, so that they keep on working.

I can't guarantee though that those "hidden" commands will still exist at the next Widget Designer version.