Jump to content
Developer Wiki and Function Reference Links ×

Rebuilding parameter choices list


LarryO

Recommended Posts

I know to get and reset the value of a PIO parameter instance using GetRField and SetRField but what is the route to rebuilding the "choices list" of a particular parameter field?

I don't suppose it is unique to the PIO instance but probably a global to the PIO definition.

Would GetObject and SetObjectVariableString be the route?

There is no SetPluginChoice or SetCustomObjectChoice is there?

Or do I just need a handle to the PIO definition and use SetRField?

And is this separator for the entries in the choices list or is it indexed somehow? &div&

 

Larry

Link to comment

Larry -

 

Assuming your PIO is Event-Enabled, use vsoWidgetPopupClear(Parameter Index) to clear the list, vsoWidgetPopupAdd(Parameter Index,Item ID, Item Text) to add items to the list, and vsoWidgetPopupSet(Parameter Index,Item Index,Item ID, Item Text) to make a given item selected.  Using vsoWidgetPopupAdd(Parameter Index,'-','-') will insert a horizontal divider line.

 

I hope this gets you headed in the right direction.

 

Link to comment

Andy,

 

I am reading the question differently. I am reading it that Larry wants to change the default fields of a PIO written by someone else, that would normally be done through the PlugIn Editor, but wants to be able to do it by script.

 

Reaching way back in the dusty cobweb covers mess that is my brain, I seem to recall that if you pass an object handle of NIL to the SetRField using the PlugIn Parameter Record, that you can set the defaults.

 

so Instead of   SetRField(HandleToTheObject,'PIORecord','PIOField','NewData');

 

If you use SetRField(NIL,'PIORecord','PIOFIeld','NewData')  

 

You will change the default value for all future instances of the PIO. In that file. I don't know of a way other than through the PlugIn Editor (which only works for some PIOs) to do a global VW wide change to the defaults.

Link to comment

Thanks guys,   You were both correct to some degree.

I created a custom title block that has a revision number displayed among other things. I have wanted to control it so that only whole number increments in sequence would be entered. I am attempting to avoid using event based scenarios; just too much overhead for the desired task.

So I was seeking to re-purpose a radio button parameter for the task.

In my PIO field 'Revision' default choice

index 1 there is a '+' sign

index 2 there is the initial default revision number '00'

index 3 there is a '-' sign

When you save the revision number of the PIO instance back to the 'Revision' field it becomes stored even if it is not one of the selectable choices. So if I store 02 there no radio buttons will highlight in the OIP but the number remains stored and accessible until a button is again selected. If I can replace index 2 of the default choices temporarily with that number at the begining of the PIO script and back again at the end to 00 then the current revision number of the selected PIO instance will display and appear selected in the radio buttons. Pressing the radio button with the '+' is going to increment the revision field and correspondingly the '-' would decrease the revision number.

I tried to use that NIL trick with SetRField but nothing changed. Perhaps because it is a radio button type field or perhaps because I'm in the PIO environment. I remember there being a difference between the definition and instance when working with symbol records which maybe my missing link here. I also would think that the function I'm searching for there needs to be a means to specify the choice index location in order to replace or store a new value, in this case at index 2. Like a corollary function to GetLocalizedPluginChoice which is used to retrieve those default values.

Oh well I can always use a Static parameter to display the current revision number above the increment/decrement radio button. I'll have to find some sort of extended characters for the middle index like up and down arrows or an emdash that will be the stable setting.

Link to comment

The NIL thing is not going to do anything to an object already in the drawing, it will only effect the defaults for when you insert the next object.

 

Why don't you store the true value in an Integer field and then do the conversion of that to the 2 digit string format for display. Then you never have to worry about the number being anything but an integer.

 

I think you are going to have a kind of hard time doing what you want from the OIP. If you instead put it in a dialog box, then you could use local variables and not actually store the data into the parameter record until the OK button is clicked.

Link to comment
19 hours ago, Pat Stanford said:

Why don't you store the true value in an Integer field and then do the conversion of that to the 2 digit string format for display. Then you never have to worry about the number being anything but an integer.

Actually I only need to temporarily store the revision value for display and manipulation in the PIO because the data for the script is retrieved from the record attached to the user editable titleblock symbol. I didn't want to hard code titleblock layouts into this PIO so I used a symbol to visually to that part. The PIO script is primarily for quality control and an interface through the OIP. (drawing file sheet name = titleblock sheet name, etc.) Hence my efforts to use the most relevant looking parameters to convey intent as well as functionality in the OIP. In this instance I have been hoping for an increment/decrement function with display of the current value in the OIP. The users eyes would not have to travel back to the titleblock to know they have the correct revision number after pressing an up or down arrow. A three value radio button is close to the concept. If only I could change the centre value on the fly so to speak.

19 hours ago, Pat Stanford said:

I think you are going to have a kind of hard time doing what you want from the OIP. If you instead put it in a dialog box, then you could use local variables and not actually store the data into the parameter record until the OK button is clicked.

In a previous topic I was hoping for a two state button (boolean) that didn't appear as a check box. I went to learn about buttons but soon I realized I would rather not event enable simple things like titleblocks and parametric symbols when it is only to enable the interface and not the object, mainly because there are other aspects of event enabled PIOs that make managing the OIP challenging. My brain also started to hurt while I was trying to understand the logic behind having to call and create so many functions to enable a single event based button in the OIP.

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