Jump to content
Developer Wiki and Function Reference Links ×

Picking symbols

Recommended Posts

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?

Link to comment

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.

Link to comment

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.  

Link to comment

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.



  • Love 1
Link to comment
  • 3 years later...
  • 4 weeks later...

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;

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.




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 by Jesse Cogswell
Link to comment
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!

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