Hide custom component

Recommended Posts

Hi All,

I want to be able to hide a custom component and only show it when another parameter is true. I have does this many times with other custom components using the ".visible" parameter. But now I have a custom component which includes buttons and this method no longer works.

How can implement this? The solution can be either for the custom component or an individual button, preferably the former.


Link to comment
Share on other sites

I'm unclear what is not working. I have a custom user component with a button which is a group and setting the group .visible to 0 makes the whole thing disappear.

Another solution for visible if it is some quirk is to instead simply move the component off the side of the screen by using .moveto() function of the component. You can then move it back when you want it to be visible.

Link to comment
Share on other sites

Here is how I created the user component:

1) Selected 2 buttons and 2 variable fields and grouped them

2) Right clicked and selected "create user component"

3) Gave it a name

I wrote a quick sequence to hide and unhide the component using .visible .... didn't work.

Here is how I made it work.

1) Same as 1 - 3 above.

2) Right clicked over the new component (while not selected)

3) Clicked on the component name which appeared at the bottom of the menu and a copy appeared

4) Test the script and it worked on the copy but not the original

Is this a quirk or is the original not actually a user component?

Link to comment
Share on other sites

When you say "gave it a name" are you talking the name of the user component, or the name of the group? Only the group name matters to the script. When you create a user component and give it a name, that's the name that shows up in the popup. DAQFactory will automatically give any new components you create with this user component the same name (provided it is a valid name), but the original group that you created the component out of remains nameless. I guess there are a few important points here:

1) when you make a group into a user component, the original remains a group. Truthfully, when you then create another instance of the user component, its just recreating the group again. You can even ungroup it into its parts. The "user component" really is to just allow for easy reuse between documents and friends. If you just want to reuse a group of components a few times in the same doc its easier to just copy the group

2) the group name (right click on the group once selected and select Component name..., or in the properties/event windows at the top) is what script uses. The user component name is just for the popup menu, but is used to name the component when you instantiate another copy.

Link to comment
Share on other sites

OK I see where I went wrong. I grouped the components and gave a name to the custom component and expected the .visible script to work. But it didn't because the original group was not named.

I will remember for next time.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.