Jump to content
Developer Wiki and Function Reference Links ×

Collapsible sections in PIO info pane?


Recommended Posts

Is there a way to create collapsible sections in the OIP for a PIO object, such as in the door object shown in the image?  Or is that something available only through the SDK?  I have a PIO that I have written which has a lot of different sections, and it can get confusing without a visual divider of sorts.   I would love to be able to collapse unused sections.

 

image.png.edc0ef3d0bac5129a1eba72f112af5d5.pngimage.png.0c59090d745e5dfaf742b837c6fdaec3.png

Link to comment
4 hours ago, Jesse Cogswell said:

@_c_ Had some success with this in Python.  The same idea should carry over in Vectorscript since the Python implementation just adds a vs. prefix to the Vectorscript commands.

 

 

Oof....I feared that this might require event enable.  That is just something I have not wrapped my head around yet.  Maybe one day...

Link to comment
  • Vectorworks, Inc Employee

Yes it requires an event enabled PIO. Here is a code snippet:


 

CONST
kWidgetGroupMode          = 81;
kWidgetSeparator          = 100;
kWidgetGroupAutomatic     = 2;
VAR
gb1 : BOOLEAN;

gb1 := SetObjPropCharVS(kWidgetGroupMode, Chr(kWidgetGroupAutomatic));
gb1 := vsoAddWidget( 1, kWidgetSeparator, 'MY FIRST GROUP' );
    gb2 := vsoAddParamWidget(2, 'ParamName1', 'Actual Param Name 1 to Display in OIP');
    gb2 := vsoAddParamWidget(3, 'ParamName2', 'Actual Param Name 2 to Display in OIP');
    gb2 := vsoAddParamWidget(4, 'ParamName3', 'Actual Param Name 4 to Display in OIP');
gb1 := vsoAddWidget( 5, kWidgetSeparator, 'MY SECOND GROUP' );
    gb2 := vsoAddParamWidget(6, 'ParamName4', 'Actual Param Name 4 to Display in OIP');
    gb2 := vsoAddParamWidget(7, 'ParamName5', 'Actual Param Name 5 to Display in OIP');
    gb2 := vsoAddParamWidget(8, 'ParamName6', 'Actual Param Name 6 to Display in OIP');

 

Additionally you could add vsoWidgetSetIndLvl(8, x ); if you wanted to further indent one of the parameters, where X = 1 or 2 or 3 being how far it is indented.


                    

  • Like 1
Link to comment
On 7/20/2022 at 11:06 PM, Julian_Carr said:

Yes it requires an event enabled PIO. Here is a code snippet:


 

CONST
kWidgetGroupMode          = 81;
kWidgetSeparator          = 100;
kWidgetGroupAutomatic     = 2;
VAR
gb1 : BOOLEAN;

gb1 := SetObjPropCharVS(kWidgetGroupMode, Chr(kWidgetGroupAutomatic));
gb1 := vsoAddWidget( 1, kWidgetSeparator, 'MY FIRST GROUP' );
    gb2 := vsoAddParamWidget(2, 'ParamName1', 'Actual Param Name 1 to Display in OIP');
    gb2 := vsoAddParamWidget(3, 'ParamName2', 'Actual Param Name 2 to Display in OIP');
    gb2 := vsoAddParamWidget(4, 'ParamName3', 'Actual Param Name 4 to Display in OIP');
gb1 := vsoAddWidget( 5, kWidgetSeparator, 'MY SECOND GROUP' );
    gb2 := vsoAddParamWidget(6, 'ParamName4', 'Actual Param Name 4 to Display in OIP');
    gb2 := vsoAddParamWidget(7, 'ParamName5', 'Actual Param Name 5 to Display in OIP');
    gb2 := vsoAddParamWidget(8, 'ParamName6', 'Actual Param Name 6 to Display in OIP');

 

Additionally you could add vsoWidgetSetIndLvl(8, x ); if you wanted to further indent one of the parameters, where X = 1 or 2 or 3 being how far it is indented.


                    

Hmmm...thank you.  I will have to look into this.  I have the entire plug-in working.  Does changing it to event-enabled change how any of the rest of it operates, or will the standard code still run just fine, while these new portions affect the OIP?

Link to comment
  • 4 weeks later...

I have coded something similar to what you want. Several years ago, I faced the same problem where I had a lot more fields than I could display. Although all my plugins are event enabled I came up with this solution before there was event enabled plugins so I do not think it is required. In the following you will see buttons for each section. When you click on each, it will display more fields under it. In the example below, the button "Pole & Foundation" displays a few fields and the button "Ped Push Button" displays only one. When clicked on each of these, they display all the fields associated with each button.

 

The concept is to keep a hidden field with the state of each button. 0 for closed and 1 for open. When setting the field visibilities, I hide the filed if the button is 0 or display the field if the button has a value of 1. In the example below, there are 7 buttons. On the left they are "closed" so the state value is 0000000. When I click on the first, it displays all the fields. When I change the value on the second button from "none" to "2", it displays the fields under that button. The state value is consequently 1100000

 

 

screenshot_15.jpg.fc37958239a2fe08cb333682625c5354.jpgscreenshot_17.jpg.e09849b5550e5085238526b5504ca006.jpg

Link to comment
On 8/18/2022 at 8:29 PM, Miguel Barrera said:

I have coded something similar to what you want. Several years ago, I faced the same problem where I had a lot more fields than I could display. Although all my plugins are event enabled I came up with this solution before there was event enabled plugins so I do not think it is required. In the following you will see buttons for each section. When you click on each, it will display more fields under it. In the example below, the button "Pole & Foundation" displays a few fields and the button "Ped Push Button" displays only one. When clicked on each of these, they display all the fields associated with each button.

 

The concept is to keep a hidden field with the state of each button. 0 for closed and 1 for open. When setting the field visibilities, I hide the filed if the button is 0 or display the field if the button has a value of 1. In the example below, there are 7 buttons. On the left they are "closed" so the state value is 0000000. When I click on the first, it displays all the fields. When I change the value on the second button from "none" to "2", it displays the fields under that button. The state value is consequently 1100000

 

 

screenshot_15.jpg.fc37958239a2fe08cb333682625c5354.jpgscreenshot_17.jpg.e09849b5550e5085238526b5504ca006.jpg

 

That looks fantastic and would work well.  But I am not aware of any button field defined in the Vectorscript field options.  And man, I really wish that texture field brought up a texture picker, or the color brought up a color picker.  So many things that could be done!

 

image.png.3802ca8f3b2e71224ef651d38d31dd0e.png

 

image.png

Link to comment
On 8/23/2022 at 9:47 PM, Miguel Barrera said:

Yes, the buttons can only be created with an event enabled script, Sorry, I am so use to them that I overlooked this fact. See Object events , example 3, for the button creation. But the code could work with a field that can register the change such as a check box.

 

Thank you @Miguel Barrera and @Julian Carr.  I have been working with the examples you've given for the past couple of days trying to figure out event-enabled scripts and what all the little widget things do and how they interact with other things. To say they are a whole different animal from standard Vectorscript is an understatement.  I've been coding in Vectorscript for many years, but Event-Enabled is truly turning my mind into spaghetti.  I'm always amazed at the sheer lack of examples for things like this that aren't more than very simple, single-action scripts.  Something I could reverse-engineer.  I shall keep plodding on in my journey.

 

 

  • Like 1
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...