VS:vsoInsertWidget
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Adds a parameter to the OI palette.
WidgetTypes:
kFieldLongInt = 1; kFieldBoolean = 2; kFieldReal = 3; kFieldText = 4; kFieldCalculation = 5; kFieldHandle = 6; kFieldCoordDisp = 7; {dimension} kFieldPopUp = 8; kFieldRadio = 9; kFieldCoordLocX = 10; kFieldCoordLocY = 11; kWidgetButton = 12; kWidgetStaticText = 13; kFieldStaticText = 14;
See the <a href=http://www.vectorlab.info/index.php?title=Events>VectorLab article</a> on object events.
FUNCTION vsoInsertWidget(
paramID :LONGINT;
widgetType :LONGINT;
mappingID :LONGINT;
text :STRING;
data :LONGINT) :BOOLEAN;
def vs.vsoInsertWidget(paramID, widgetType, mappingID, text, data): return BOOLEAN
Parameters
paramID LONGINT widgetType LONGINT mappingID LONGINT text STRING data LONGINT
Remarks
This function inserts a widget into the OIP. It allows the user to define the location of where this widget will be in the OIP widget list.
paramID: The ID and location of where this widget will be displayed in the OIP. widgettype: Type of widget to create. mappingID: ordinal value of object parameter that corresponds to this widget. text: the label to be displayed on OIP for this widget. data: not implemented yet.
At least in 2008, there might be a bug in this call. The "mappingID" argument doesn't seem to be registering the index of the widget properly, and as a result, if the widget is a button, you won't get the proper index in the button click event. If somebody fully investigates this, and determines that it's a bug, he/she should enter a bug report.
vsoAppendWidget still works OK.
It looks like the problem occurs if you don't declare kObjXPropHasUIOverride (kObjXPropHasUIOverride is FALSE or not declared):
result := SetObjPropVS(kObjXPropHasUIOverride, TRUE);
Example
<pre>kOnInitPropertiesEventID: BEGIN resultStatus := SetObjPropVS(kObjectHasUIOverrideID, TRUE); resultStatus := vsoInsertParamWidget(1,1, 'Unused number', 0); resultStatus := vsoInsertParamWidget(2,2, 'Static Text Widget', 0); resultStatus := vsoInsertParamWidget(3,3, 'Enter junk here', 0); resultStatus := vsoInsertParamWidget(4,4, 'Previous static text', 0); resultStatus := vsoInsertWidget(5,kWidgetButton, 5,'Update Text', 0); END;</pre>
Version
Availability: from All Versions
This is drop-in function.