VS:InsertChoice

From Vectorworks Developer
Jump to: navigation, search

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

Description

Procedure InsertChoice adds a new value to a dialog choice item list.
PROCEDURE InsertChoice(
item  :INTEGER;
before  :INTEGER;
choice  :STRING);
def vs.InsertChoice(item, before, choice):
    return None

Parameters

item INTEGER Item ID of dialog control.
before INTEGER Position in list where new item will be inserted.
choice STRING String value of new item.

Remarks

Note: deprecated from VW 15+, use AddChoice

Adds a new value to a combo box. before is the index where you would like to add the value. choice is the value to add.

For the multicolumn list box, items in different columns must be separated by tab characters. I.e., use this function to set a whole line at a time, with columns separated by tab characters. All tab stops must have been set before calling this function.

Choices added to list boxes and pulldown menus in modern custom dialogs MUST begin with 0 and have a consecutive, unbroken numbering for items to be displayed in the control.

Non consecutive numbering will cause control list loading to fail at the break in numbering on Win32 systems.

Derek gave us the VectorWorks preference ID (SetPref(12348, T/F)) to temporarily turn off dialog refreshing so that we can load lists, etc. in the background. This dramatically speeds up dialogs that handle long lists.

To insert choices into a list box that has tab stops, add tabs to the string to separate the values.

Example

VectorScript

InsertChoice(cid,0,'1x');
InsertChoice(cid,1,'2x');
InsertChoice(cid,3,'3x');
InsertChoice(cid,4,'4x');
InsertChoice(cid,5,'5x');
InsertChoice(cid,6,'10x');
InsertChoice(cid,7,'15x');

will fail after '2x' is loaded.

Failure to have a zero-th item in the list will cause the loading of the control list to fail completely (again, on Win32 systems).


InsertChoice(cid,1,'1x');
InsertChoice(cid,2,'2x');
InsertChoice(cid,3,'3x');
InsertChoice(cid,4,'4x');
InsertChoice(cid,5,'5x');
InsertChoice(cid,6,'10x');
InsertChoice(cid,7,'15x');

will fail completely.

Both of these examples will load the control successfully on Macintosh systems.

Python


Version

Availability: from VectorWorks 8.0. Deprecated from VW 15+.
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox