Obj with geometry creation outside PIO

From Vectorlab
Jump to: navigation, search


Object that creates geometry in the drawing, not within the PIO:

by  Charles Chandler, Januar 2007

PROCEDURE Example10;
CONST
	kObjOnInitXProperties = 5;
	kResetEventID = 3;
	kObjXPropHasUIOverride = 8;
	kWidgetButton = 12;
	kObjOnObjectUIButtonHit = 35;
	buttonID_1 = 1234; {user-definable index}
VAR
	theEvent, theButton :LONGINT;
	result :BOOLEAN;
	buttonEventID :INTEGER;
	displayString :STRING;
	thisDoesNothing :LONGINT;
BEGIN
	vsoGetEventInfo(theEvent, theButton);
	CASE theEvent OF

		{User has single-clicked the object's icon.}
		kObjOnInitXProperties: 
			BEGIN
				{This tells VW to let the object decide what goes
				onto the Object Info palette.}
				result := SetObjPropVS(kObjXPropHasUIOverride, TRUE);

				{Add the button.}
				displayString := 'Create Stray Rectangle';
				result := vsoAppendWidget(kWidgetButton, buttonID_1, displayString, thisDoesNothing);
			END;

		{User has clicked a button in the Object Info palette.}
		kObjOnObjectUIButtonHit:
			BEGIN
				CASE theButton OF
					buttonID_1:
						BEGIN
							{This rectangle is created OUTSIDE of the PIO.}
							Rect(0, 0, 1, 1);
						END;
				END;
			END;

		{Object reset has been called.}
		kResetEventID: 
			BEGIN
				{This rectangle is created INSIDE of the PIO.}
				Rect(0, 0, 1, 1);
			END;

	END;
END;
RUN(Example10);

See also

Events