Disabling a button or Hiding a Custom Script Button

Moderator: Moderator Group

Disabling a button or Hiding a Custom Script Button

Postby crotkosky » Tue Jan 19, 2016 6:54 pm

I've come across a task where in the client needs to have access to a Widget panel.

There are a couple of buttons I'd like to have disabled unless some layers are active to screen. I tried the WDCustomScriptMuteClick Command via a NODE set up PBDeviceParameter - Script output IF - THEN statement. This I could not get to work successfully. I did find by reading through posts, that another user was encouraged to use the ControlShow / ControlHide solution. This works great, and solves my problem but does not look very nice, as buttons are appearing and disappearing. I also read this following post, (link below) a script used to disable a button with IF THEN statements. I dont think though this is exactly what I am looking for.

viewtopic.php?f=80&t=3714&p=11330&hilit=Mute#p11330

Have a great week everyone!! Thanks in advance for any input.
Best,
Chris
crotkosky
 
Posts: 10
Joined: Wed Jan 06, 2016 8:50 pm

Re: Disabling a button or Hiding a Custom Script Button

Postby malkuth23 » Wed Jan 20, 2016 12:43 am

I would probably do the if/then method.
Why would that not work for your code? Are you tracking a ton of layers?
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 350
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA

Re: Disabling a button or Hiding a Custom Script Button

Postby crotkosky » Wed Jan 20, 2016 1:29 am

Unfortunately I do not have a lot of experience with writing the code aspect of this yet. So as I understand the concept of the if - then statements and = to etc. I do not know how to figure them into / or where to put them in the script boxes... :) these are the things I'm learning as I go. Thanks!!! I'll task myself to learn this.

Best,
Chris
crotkosky
 
Posts: 10
Joined: Wed Jan 06, 2016 8:50 pm

Re: Disabling a button or Hiding a Custom Script Button

Postby malkuth23 » Wed Jan 20, 2016 5:23 am

So here is the basic idea:

Each layer should be represented by a variable.

Create each variable where 0=not visible and 1=visible. This can alternatively be done in the variable tool. Use integer.
Code: Select all
layer1Vis = 0
layer2Vis = 0


Then in each button use code like this:
Code: Select all
if layer1Vis = 1
{
//do some cool stuff
}


Adjust the variables by using a node to check the pb layer opacity (or whatever parameter is relevant) and output to a variable node.
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 350
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA

Re: Disabling a button or Hiding a Custom Script Button

Postby chrisr » Fri Jan 29, 2016 11:11 pm

Matthew,
Thanks for the head start with this information.

Cheers,
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD v6
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager v6
chrisr
 
Posts: 143
Joined: Tue Jan 26, 2016 10:50 pm

Re: Disabling a button or Hiding a Custom Script Button

Postby chrisr » Thu Apr 14, 2016 5:45 pm

Matthew-

Totally forgot to reply to this. That worked fantastic, thank you very much!

my Lock button wrote a variable UnLocked = 1, Locked = 0

So the Script looked like

If LockVar = 1
{
Do cool stuff
}
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD v6
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager v6
chrisr
 
Posts: 143
Joined: Tue Jan 26, 2016 10:50 pm


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 18 guests