VS:AddChoiceItem

From Vectorworks Developer
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Adds a choice item control to a custom dialog definition. A choice item allows the user to select an item from multiple list options. Options for the itemID parameter are: 1) pop-up, 2) multi-select list box, and 3) single-select list box.


Combo Box-Popup Default State:

Combo Box-Popup Default State

Combo Box-Popup Open State:

Combo Box-Popup Default State

PROCEDURE AddChoiceItem(
choiceTitle :STRING;
itemID :INTEGER;
choiceType :INTEGER;
x1 :INTEGER;
y1 :INTEGER;
x2 :INTEGER;
y2 :INTEGER);
def vs.AddChoiceItem(choiceTitle, itemID, choiceType, x1, y1, x2, y2):
    return None

Parameters

choiceTitle STRING Descriptive text string for the choice item.
itemID INTEGER Unique item ID for the choice item control, in a range of 1-50.
choiceType INTEGER The type (style) of choice item control to be displayed.
x1 INTEGER Top left X coordinate of the control bounding box.
y1 INTEGER Top left Y coordinate of the control bounding box.
x2 INTEGER Bottom right X coordinate of control bounding box.
y2 INTEGER Bottom right Y coordinate of control bounding box.

Remarks

Note: AddChoiceItem is deprecated from VW 9+:

Adds a choice item to a dialog. Currently, the only supported choice type is a combo box, so 1 should always be passed as the choiceType parameter. choiceTitle is the label that will appear next to the combo box. itemID is the item number in the dialog. x1, y1, x2, and y2 specify the size of the combo box.

The first parameter in the procedure doesn't do anything; left as-is for VW8 due to time constraints

choiceType can now be set to 2 to create a multi-selection list box.

choiceType can now be set to 3 to create a single-selection list box.

List boxes only display 128 items. 128 * 255 = 32767 (approx) This may be a Mac-only limit.

Also on the Mac, pop-ups with more than 512 items cause hard system crashes (heap corruption).

Example

VectorScript

AddChoiceItem('Topping Type',4,1,25,50,150,115);

Python


Version

Availability: from MiniCAD 7.0. Deprecated from VW 9+.

See Also

VS Functions:

VS Functions:
  • [[VS:InsertChoice|InsertChoice]]
  • [[VS:CreateRadioButton|CreateRadioButton]]
  • [[VS:CreatePullDownMenu|CreatePullDownMenu]]
  • [[VS:CreateCheckBox|CreateCheckBox]]