Jump to content
Developer Wiki and Function Reference Links ×

Visible/Not visible via double-click


Recommended Posts

Is it possible to create a script like


case option of

TRUE; Show(C='...

FALSE; Hide(...


I would like to have one "Script", which i start with the "option" key pressed or not. The result should make visible or unvisible certain objects, classes, etc.

It seems that the pressing of the option key is not recognized as i would like it.

Kind regards

Link to comment

Just a thought...if all you're doing is toggling class visibility off and on, you only have to get the current state and change it to the other.

I use this in 8.5.2:

Procedure front_vis;




classname:=StrDialog('Change Visibility of Class: ','front');

Case GetCvis(classname) of







This invokes a dialog where you can input any class name.The default string 'front' is the one I change the most. If you want a single purpose script get rid of StrDialog and hard code your class there.

The drawback is the use of a literal...if you spell the name wrong nothin happens. A dialog with a pop-down of existing classes would be universal. I just haven't gotten around to it cause I'm the only one using this script.

There's probably a universal one at VectorDepot.

Link to comment

Hey thank you all for your advice:

"but" i do not want to work with command HideClass() but with the command Hide(..anything..). If i use this command there seems to be no redraw of the whole drawing.

The "keydown"-command does not seem to work the way i want it to work. Can't i determine within a script, whether this script has been started with just double click or (option/shift...)double-click.

Kind regards

Link to comment

Is an easy way:

-Split your two (or more) options as different scripts.

-You set them up as tool plugins (organize/script)

-Set in your workspace new key shortcuts for the new tools as folow:

option 1: "YourKey"

option 2: "Option+YourKey"

option 3: "shift+YourKey"...

-You just need then to call the tool you need using the right modify key.

-To redraw use Redraw, for the whole drawing try RedrawAll.

Is not exactly what you ask for, but I hope that helps...

Link to comment

Well...if we did have a function IsVisible:Boolean, then you could use the same logic I'm using. I'm not aware of a way to test the visibility of an object, but there's probably a way.

I don't think a script can "know" how it was started,whether from a script pallette or a menu command or with option down or not. It isn't alive until run-time.

So I think you would start the script and then look for user input. Maybe mouse-click and option+mouse-click on the drawing. Or the script waits for "v" or "i" key.

Or build a dialogue with a radio button for visible/invisible. If you get that working you could have a drop-down with a few different choices of which ojects you wish to change.

[ 10-07-2003, 06:12 PM: Message edited by: ccroft ]

Link to comment

Is a big flaw on the concept Click to switch visibility: how to click on a object that you can not see ?

Anyways the hidden objects become visible as soon you switch classes. But even visible they have a invisible variable, and you could run an Hide (v=false); to get rid of everything.

Once you have select ( a name, handle... ) an object you could test his visibility by a V=false and mach your object to the resulting list, but somebody else may have something more practical (incredibly there is no visibility index selector for an GetObjectVariableBoolean() !!! )

The bounding of an invisible box seems to have hollow selectors. But a hide script could add some dash line to make the all think easier to see.

He still a nice way to clear up a drawing in a click (or a key stroke), and bit like work with guides but with out the extra classes to worry about...

I don't think you could set VW to run a script when you Option+click from the normal cursor position, you need to make a call to the script by a selection on a palette, or a Key shortcut to a plugin.

But there is another idea for the never ending wish list: Add our own events to a modifier key on the selection tool... could be a good one!

Link to comment

As I understand it, he wants to change visibility of objects based on criteria: like ((t=rectangle)&(C='whatever')). In this way you don't need to click on invisible objects, and the search can be modified to be very specific.

The click or option/click is a selector for which branch the script would take, and would be done anywhere on the drawing. If it's a tool, the script won't run by simply getting that tool...you need to do something to the drawing to make it run. I think assigning keys as the selectors (i for invisible and v for visible) will work if the script is a menu command.

The best would be a simple toggle, but then you need a way to determine the visibility status of the objects that meet the search criteria. Hide(v=true) would be great...but you need a way to test the objects current status and set v accordingly.

I think your suggestion of two scripts, one to show whatever and one to hide whatever, would work well as 2 menu commands with keys assigned as you suggest.

I think the ultimate would be a dialog with a choice box for different searches that are used often, a text box for custom searches and a radio button for hide/show.

Sound familiar? It's very much like the custom visibility command that comes with the program, but instead of saving the sets of criteria in a palette and running them from there,we have them in a menu command.

Maybe the existing solution isn't so bad?

Link to comment

Though you can't test for a lone modifier key being pressed from VS, you can test for a key repeat event. See the AutoKey function.

There is a caveat, you need to press a key that will not do anythin inside VW, like select a tool, etc. I use the letter "B" in my workspace, which does nothing. If you use "B", you will need to isolate another key and use it for your scripting.

Though I haven't tried checking the modifier flags at this time, it might work, if you should need more than one input flag at the start of a script.

Good luck,


Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...