michaelk Posted July 29, 2019 Share Posted July 29, 2019 I'm working on a tool that uses 4 different symbols as components. Currently I'm specifying the symbol as a text field in the OIP. Not the most elegant solution. I don't recall seeing another tool that lets you get to a symbol picker from the OIP. And I haven't run across a VS way of building a Settings… dialog. Is it possible to create a simple symbol picker in the OIP? Or from a preference in the mode bar? Quote Link to comment
JBenghiat Posted July 29, 2019 Share Posted July 29, 2019 Sure: http://developer.vectorworks.net/index.php/VS:vsoButtonGetResource The object has to be event and custom widget enabled. kWidgetResourcePopup = 107 Mode bar options are a bit of a challenge in vs, but it is possible: http://developer.vectorworks.net/index.php/VS:vstResPDMenuInit The OIP resource popup is somewhat limited in VS. If you want more complex behavior, use a button to launch a dialog with a resource picker. Quote Link to comment
michaelk Posted July 29, 2019 Author Share Posted July 29, 2019 Thanks, Joshua. That is super helpful. So vsoButtonGetResource creates a button in the shape pane of the OIP? Like the Settings… button on a door or window object? How does it know where to put the button in the OIP? (he said without reading up on it). There goes my free time for a while. Quote Link to comment
JBenghiat Posted July 29, 2019 Share Posted July 29, 2019 No, vsoAddWidget or vsoInsertWidget adds the widget to the OIP. vsoButtonGetResource is what you call in the button handler to raise the resource picker. You specify the parameter that actually stores the name of the resource. Quote Link to comment
Miguel Barrera Posted July 31, 2019 Share Posted July 31, 2019 Do you need to see the graphic of the symbol? If not, why not just add the symbol name to a popup parameter. I have not used vsoButtonGetResource because it is only available from VW 2018. I created the following dialog in 2014, Select Sign Legend, which would be similar to that. The dialog is activated by clicking on the OIP LEGEND button and the selected sign is store in the Sign Type parameter. Other parameters get their value from the record attached to the symbol. The following is a variation of the same idea but the dialog has a tree picker control instead. I created this plugin to scale symbols before the capability was added to symbols. 1 Quote Link to comment
michaelk Posted July 31, 2019 Author Share Posted July 31, 2019 Miguel That is really cool. It makes me think about a lot of things… In this case I need to be able to make new symbols on an ad hoc basis. But wow. That is cool! Quote Link to comment
The Hamma Posted June 26, 2023 Share Posted June 26, 2023 Is there a simple example of the code to create the dialog to pick a symbol from a script? Quote Link to comment
SamIWas Posted July 20, 2023 Share Posted July 20, 2023 I have tried so many times to wrap my head around event-enabled scripts so that I can have sections and buttons and other things in my OIP. But instead, I decided to just go put my head through a wall because it's less painful. 1 1 Quote Link to comment
Jesse Cogswell Posted July 21, 2023 Share Posted July 21, 2023 @SamIWas I wrote up an example of an Events Enabled plug-in a couple of months ago that includes the code for a pretty nice symbol picker (as well as the default vsoButtonGetResource function). I've notated most of it with what the code is doing, have a look and let me know if you have any questions. Event Enabled Example.vso Quote Link to comment
SamIWas Posted July 21, 2023 Share Posted July 21, 2023 @Jesse Cogswell Oh boy! Thank you. I will have to dig into this. But my brain is too tired right now. One thing I really want to learn is how to make a collapsible header like you get in eh door or window tool. Someone else has linked to a way before, so I need to look through that as well. Quote Link to comment
Jesse Cogswell Posted July 21, 2023 Share Posted July 21, 2023 That's covered in my example linked above. It's easier than you might think, you just need to toggle it on and then set intents on your parameters. Quote Link to comment
SamIWas Posted July 21, 2023 Share Posted July 21, 2023 2 hours ago, Jesse Cogswell said: That's covered in my example linked above. It's easier than you might think, you just need to toggle it on and then set intents on your parameters. I see headers, but not collapsible headers. Quote Link to comment
Jesse Cogswell Posted July 22, 2023 Share Posted July 22, 2023 Sorry, I posted the VW2019 version of the plug-in which didn't have that code since VW2019 doesn't support that feature. I've updated the code to include it and attached it below. Event Enabled Example.vso Quote Link to comment
Jesse Cogswell Posted July 22, 2023 Share Posted July 22, 2023 (edited) The key lies in the following three lines of code, the top two are part of the global constant declaration block and the final one will be part of your kObjOnInitXProperties event in the main driver. {Event Constants} kWidgetGroupMode = 81; kWidgetGroupModeAutomatic = 2; {kObjOnInitXProperties} result:=SetObjPropCharVS(kWidgetGroupMode, C h r(kWidgetGroupModeAutomatic)); You will also need to set the indent of the things to collapse using the vsoWidgetSetIndLvl function. I have a procedure called SetIndent in my code that allows you to specify a start and an end and will indent everything in between. You'll need to do this for parameters and buttons. EDIT: There's something weird with the forum's code box, it won't let me type in the code for setting the character, so remove the spaces in between C h r in the code. Edited July 22, 2023 by Jesse Cogswell Quote Link to comment
MullinRJ Posted July 22, 2023 Share Posted July 22, 2023 7 hours ago, Jesse Cogswell said: There's something weird with the forum's code box, it won't let me type in the code for setting the character, so remove the spaces in between C h r in the code. @Pat Stanford ran into that a week or so ago. You’re in good company. 😋 Raymond 3 Quote Link to comment
Pat Stanford Posted July 22, 2023 Share Posted July 22, 2023 Interesting. My problem was with =CHR. When I replied the next time it let me enter CHR without a problem. I know they upgraded the forum software recently due to a security bug. May have something to do with that. 1 Quote Link to comment
SamIWas Posted July 23, 2023 Share Posted July 23, 2023 23 hours ago, Jesse Cogswell said: Sorry, I posted the VW2019 version of the plug-in which didn't have that code since VW2019 doesn't support that feature. I've updated the code to include it and attached it below. Event Enabled Example.vso 19.1 kB · 6 downloads This is really helpful! I think I have finally been able to parse most of this and figure out what it does. Going to try to really dig into it when I'm back on my big system at home. But I think I can work from this and update a couple of my plugins to make use of this style. Having the collapsible headers and maybe a symbol dialog will be great! 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.