Jump to content
Developer Wiki and Function Reference Links ×

SetParameterVisibility


Recommended Posts

I'm creating a plug-in using SetParameterVisibility to change visibility of parameters in the OIP, which works fine. However I am wondering if it is possible for this to work in the properties dialog before the object is placed?

I had a search and it looks like this has not been answered yet. My apologies if it has been covered already.

At the moment I have everything hidden by default (using __PARAM) except for a popup. Once the object has been placed you select the detail from the popup which then shows the relevant params? This might be the best way.

WIN Vista

VW2009 SP4

Cheers

Edited by sittingduckz
Link to comment

From the Vectorscript Language guide

Setting Default Parameter Visibility

Additionally, default parameter visibility may be set for objects, menus, and tools in the VectorScript Plug-in Editor/Edit Parameter dialog box. By placing two leading underline characters as a prefix to the parameter?s universal name, the parameter visibility is set to false. Using this technique hides a parameter in the default settings dialog box for a plug-in. Parameters with this special universal name prefix will not be shown unless explicitly made visible using SetParameterVisibility.

Link to comment

What Pat said is true - except that things work a little differently for the Prefs dialog.

SetParameterVisibility needs the handle of the PIO instance in order to function. When the Prefs dialog is shown, no such handle exists.

If "PIOH" is handle you're using for SetParameterVisibility and "PIOName" is the name of your PIO, try adding the bits below before your visibility calls:

If (PIOH = Nil) then

Begin

PIOH := GetObject (PIOName);

End;

Hopefully, that will help.

Link to comment

Pay attention that SetParameterVisibility won't work under VW14 over double-underscore prefixed parameter names.

It works on previous versions (bugfiled).

so for example:

SetParameterVisibility(myRunningPIOhandle, '__HiddenParm', (myVar = aCertainValue));

{ toggles the visibility of the parameter '__HiddenParm' for any VW version but not for VW14, where it keeps invisible }

orso

Link to comment

Duckz,

If you haven't already done so, a reading of Charles Chandlers excellent articles on events might be useful:http://www.vectorlab.info/index.php?title=Events

In particular 'Preferences Button' and 'Object Info Palette Behaviors'.

Also, I may be mistaken but isn't objHD and GetOject(objName) getting you the same handle after calling GetCustomObjectInf? Both would be the handle to the currently executing object.

If you're trying to determine if this is the first use of the object in the drawing IsNewCustomObject will get the job done.

I'm hardly an expert, but it seems that the behavior you want might not be possible with vScript. An alternate approach might be to use a custom dialog for the Preference Event on first insertion, though that might be more work than it's worth.

Link to comment

Yes, it's a minor bug, I bugfiled it.

GetOject(objName) gets you a handle to the PIO record in the document, that is, any edit there edits the preferences.

So to edit the visibility in the pref pane can only be done using the doc rec, if it can be done (never needed it, so never tried).

Sittingduckz, I don't seem to have seen you on the VectorScript list: http://lists.nemetschek.net/archives/vectorscript-l.html

Please log in, if you didn't already. There is where we exchange since years. There you find the most answers to your questions. The old scripters (those dinosaurs) seem to ignore this brand new VS forum here on TechBoard.

99% of the times what you wish to know have been asked already.

Vectorlab is for freaks. For VS-obsessed.

You'll find there a lot of useful stuff. Recently I added tons of content, so you might like to give a go to it.

---

People, I had to block edits for non-admins on Vectorlab. Even had to block login for new users.

There was another wave of spam attacks, escaping all conceivable protections that I have there. I apologize. I'll keep the blocks for a while still.

Anyone legitimate can request me an exception, just mail me, should you wish to login/edit/create articles there. My public mail address is to be found on the VectorScript list. Just search for "orso".

ciao,

Orso

Link to comment

I see from another post that you have things working as you like. If you care to pursue this, though...

As to the specific calls not working...,

- Orso is quite correct; the eventing article on VCOR is a must-read as you work through this. What you're wanting needs eventing enabled in order to work.

- What you're wanting (if I'm understanding your question correctly) is quite doable.

- As part of your code, do you have a line similar to: resultstatus := SetObjPropVS(4,False);? A "True" there will hide the dialog, but I had to include this line in my scripts in order to control parameter visibility in the Prefs dialog.

- GetCustomObjectInfo doesn't work (at least, it doesn't @ my end) for the Prefs dailog. My assumption is that the reason for this is that, at the point of displaying the dialog, the PIO isn't actually executing, so no handle is available.

- I also had issues w. IsNewCustomObject working to determine Prefs parameter visibility. Checking for a Nil handle or embedding a trigger parameter was the work-around for that.

Link to comment
GetOject(objName) gets you a handle to the PIO record in the document, that is, any edit there edits the preferences.

So to edit the visibility in the pref pane can only be done using the doc rec, if it can be done (never needed it, so never tried).

Orso

Hi Orso,

Thanks for pointing out my mistake. I forgot about that.

If you get the record you can set document defaults with the record calls, but I wonder how you would set/change visibilites of record fields?

I'm always interested in learning something new, so I went and searched the archives on list-serve for 'hide default preferences' and found some good stuff. Heiner posted a template there for an event enabled PIO that bypasses that event. You can just hide the pref Pane or Object Creation pane or whatever it's called just as Andrew describes.

(I rarely see it, since I'm usually working in a template that has already had my PIO's inserted and therefore already has the document record present.)

Thank-you Gentlemen!

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.

Guest
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...