sittingduckz Posted July 30, 2009 Share Posted July 30, 2009 (edited) 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 July 30, 2009 by sittingduckz Quote Link to comment
Pat Stanford Posted July 31, 2009 Share Posted July 31, 2009 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. Quote Link to comment
C. Andrew Dunning Posted July 31, 2009 Share Posted July 31, 2009 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. Quote Link to comment
_c_ Posted August 2, 2009 Share Posted August 2, 2009 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 Quote Link to comment
sittingduckz Posted August 2, 2009 Author Share Posted August 2, 2009 Thanks Pat, But Obviously I had already read the help files Quote Link to comment
sittingduckz Posted August 2, 2009 Author Share Posted August 2, 2009 Thanks Andrew, I tried your idea with not success. Is this what you had in mind? resultstatus := GetCustomObjectInf (objName,objHd,recHd,wallHD); If (objHd = Nil) then Begin objHd := GetObject (objName); End; Cheers Quote Link to comment
sittingduckz Posted August 2, 2009 Author Share Posted August 2, 2009 Orso, I am not having this issue, I have most params hidden with double underscores and they work fine. One thing I did discover is they seem to need an Alternate Name as well to work, I had some with and some without and only the ones with seemed to work... now they all do Quote Link to comment
_c_ Posted August 2, 2009 Share Posted August 2, 2009 Yes, to be precise, they will only be togglable with SetParameterVisibility if * the alternate name exists AND * is not prefixed with under-score but this is a regression from previous versions Orso Quote Link to comment
ccroft Posted August 2, 2009 Share Posted August 2, 2009 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. Quote Link to comment
sittingduckz Posted August 2, 2009 Author Share Posted August 2, 2009 ccroft Cheers, I will have a read of that. Looks interesting My PIO works fine at the mo. All params are hidden until the user makes a choice on a popup. That will do for now Quote Link to comment
sittingduckz Posted August 2, 2009 Author Share Posted August 2, 2009 (edited) orso, I agree, if it was done intentionally it should be explained clearer in the help files with 'SetParameterVisibility'. The fact it isn't pointed out makes it sound like a bug? Edited August 2, 2009 by sittingduckz Quote Link to comment
_c_ Posted August 3, 2009 Share Posted August 3, 2009 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 Quote Link to comment
C. Andrew Dunning Posted August 3, 2009 Share Posted August 3, 2009 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. Quote Link to comment
ccroft Posted August 3, 2009 Share Posted August 3, 2009 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! Quote Link to comment
Recommended Posts
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.