VS:vsoInsertWidget: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
m (put info from remarks to description and parameters section)
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Adds a parameter to the OI palette.
This function inserts a widget into the ObjectInfoPalette. It allows the user to define the location of where this widget will be in the OIP widget list.


WidgetTypes:
WidgetTypes:
<code lang="pas">
<code lang="pas">
kFieldLongInt     = 1;
kFieldLongInt     = 1;
kFieldBoolean     = 2;
kFieldBoolean     = 2;
kFieldReal       = 3;
kFieldReal       = 3;
kFieldText       = 4;
kFieldText       = 4;
kFieldCalculation = 5;
kFieldCalculation = 5;
kFieldHandle     = 6;
kFieldHandle     = 6;
kFieldCoordDisp   = 7; {dimension}
kFieldCoordDisp   = 7; {dimension}
kFieldPopUp       = 8;
kFieldPopUp       = 8;
kFieldRadio       = 9;
kFieldRadio       = 9;
kFieldCoordLocX   = 10;
kFieldCoordLocX   = 10;
kFieldCoordLocY   = 11;
kFieldCoordLocY   = 11;
 
kWidgetButton     = 12;
kWidgetButton     = 12;
kWidgetStaticText = 13;
kWidgetStaticText = 13;
kFieldStaticText = 14;
kFieldStaticText = 14;
        kWidgetDimStdPopUp = 16;
kWidgetPrecisionPopUp = 17;
kWidgetClassesPopup = 18;
kWidgetLayersPopup = 19;
kWidgetAngleDisp = 20;
kWidgetAreaDisp = 21;
kWidgetVolumeDisp = 22;
kWidgetSeparator = 100;
kWidgetSubSelection = 101;
kWidgetBoundPopup = 102;
kWidgetBoundOffset = 103;
</code>
</code>


Line 46: Line 56:
paramID
paramID
LONGINT
LONGINT
 
The ID and location of where this widget will be displayed in the OIP.
</line>
</line>
<line>
<line>
widgetType
widgetType
LONGINT
LONGINT
 
Type of widget to create.
</line>
</line>
<line>
<line>
mappingID
mappingID
LONGINT
LONGINT
 
Ordinal value of object parameter that corresponds to this widget.
</line>
</line>
<line>
<line>
text
text
STRING
STRING
 
The label to be displayed on OIP for this widget.
</line>
</line>
<line>
<line>
data
data
LONGINT
LONGINT
 
Not implemented yet.
</line>
</line>
</lineList>
</lineList>
Line 78: Line 88:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark>
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.
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.
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.
vsoAppendWidget still works OK.
Line 99: Line 102:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample>
<sample>
==== VectorScript ====
<code lang="pas">
<code lang="pas">
<pre>kOnInitPropertiesEventID:  
kOnInitPropertiesEventID:  
BEGIN
BEGIN
   resultStatus := SetObjPropVS(kObjectHasUIOverrideID, TRUE);
   resultStatus := SetObjPropVS(kObjectHasUIOverrideID, TRUE);
Line 108: Line 112:
   resultStatus := vsoInsertParamWidget(4,4, 'Previous static text', 0);
   resultStatus := vsoInsertParamWidget(4,4, 'Previous static text', 0);
   resultStatus := vsoInsertWidget(5,kWidgetButton, 5,'Update Text', 0);
   resultStatus := vsoInsertWidget(5,kWidgetButton, 5,'Update Text', 0);
END;</pre></code>
END;</code>
==== Python ====
<code lang="py">


</code>
</sample>
</sample>



Revision as of 16:36, 23 March 2018

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

Description

This function inserts a widget into the ObjectInfoPalette. It allows the user to define the location of where this widget will be in the OIP widget list.

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;
        kWidgetDimStdPopUp	= 16;
	kWidgetPrecisionPopUp	= 17;
	kWidgetClassesPopup	= 18;
	kWidgetLayersPopup	= 19;
	kWidgetAngleDisp	= 20;
	kWidgetAreaDisp		= 21;
	kWidgetVolumeDisp	= 22;
	kWidgetSeparator	= 100;
	kWidgetSubSelection	= 101;
	kWidgetBoundPopup	= 102;
	kWidgetBoundOffset	= 103;

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 The ID and location of where this widget will be displayed in the OIP.
widgetType LONGINT Type of widget to create.
mappingID LONGINT Ordinal value of object parameter that corresponds to this widget.
text STRING The label to be displayed on OIP for this widget.
data LONGINT Not implemented yet.

Remarks

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

VectorScript

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;

Python


Version

Availability: from All Versions

This is drop-in function.