Jump to content
Developer Wiki and Function Reference Links ×

Standard size Plug-in issue


Yancka

Recommended Posts

If several instances of my custom made PIO are selected and some parameters are changed to all selected instances simultaneously the following issues appear:

1. In OIP all parameters are visible and are enabled.

2. Only 1 PIO is OK, others are kinda broken until some parameter of specific PIO instance is changed.

3. In the schedule (quickest method to check this is to create a report) sizes are OK only to this 1 PIO.

If working with 1 only PIO everything looks just fine. Problem persists only if working with 2 or more PIOs and they are standard size (Standard size parameter is unchecked). Would there be a problem with logics of how I've made up setting standard sizes? Or would the problem be in function I use to retrieve object handle (FSactLayer) and the solution would be to foresee possibility of multiple selection and then cycle through selection set? If last one seem to be correct, pls give some hint on how to include such cycle into code of PIO.

Here's the code of simple plug-in I wrote to check this:

PROCEDURE Quadrilateral;
VAR
RectWidth, RectHeight :REAL;
PluginHandle :HANDLE;
BEGIN
RectWidth:=PBox_Width;
RectHeight:=PBox_Height;
PluginHandle:=FSactLayer;

IF PCustom_size=false THEN
	BEGIN
		EnableParameter(PluginHandle,'Box Width',false);
		EnableParameter(PluginHandle,'Box Height',false);
		IF PQuadrilateral_type='Square' THEN
			BEGIN
				IF PSquare_standard_size='A1' THEN RectWidth:=350;
				IF PSquare_standard_size='A2' THEN RectWidth:=680;
				IF PSquare_standard_size='A3' THEN RectWidth:=975;
			END;
		IF PQuadrilateral_type='Rectangle' THEN
			BEGIN
				IF PRectangle_standard_size='T1' THEN BEGIN RectWidth:=350; RectHeight:=680; END;
				IF PRectangle_standard_size='T2' THEN BEGIN RectWidth:=680; RectHeight:=975; END;
				IF PRectangle_standard_size='T3' THEN BEGIN RectWidth:=975; RectHeight:=1550; END;
			END;
	END
ELSE
	BEGIN
		EnableParameter(PluginHandle,'Square standard size',false);
		EnableParameter(PluginHandle,'Rectangle standard size',false);
	END;

IF PQuadrilateral_type='Rectangle' THEN SetParameterVisibility(PluginHandle,'Square standard size',false) ELSE
	BEGIN
		SetParameterVisibility(PluginHandle,'Rectangle standard size',false);
		EnableParameter(PluginHandle,'Box Height',false);
		RectHeight:=RectWidth;
	END;

SetRField(PluginHandle,'2D Quadrilateral','Box Width',Num2Str(0,RectWidth));
SetRField(PluginHandle,'2D Quadrilateral','Box Height',Num2Str(0,RectHeight));

MoveTo(-RectWidth/2,0);
Rect(-RectHeight,#90,RectWidth,#0);
END;
Run(Quadrilateral);

Link to comment

Yancka,

I think the problem is that your code uses FSActLayer to get a handle to itself. Instead, use GetCustomObjectInfo, which gets a handle to the PIO associated with it's obj info parameters. Here's my basic code framework:

VAR

PIHan :HANDLE; {handle to Plug-In}

PIRecHan :HANDLE; {Handle to Plug-In Record}

PIWallHan :HANDLE; {Handle to wall containing Plug-In}

PIName :STRING; {Name of Plug-In definition}

BEGIN

IF GetCustomObjectInfo(PIName,PIHan,PIRecHan,PIWallHan) THEN BEGIN

{--- Regen Code Here ---}

END;

END;

-Josh

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...