Home

PIO Object FrameWork:

{the following PIO global variables --must be in main VAR block
PioName: STRING;
PH,PRH,PWH: HANDLE;
NewPIO: BOOLEAN;}

Function cVerPIO(EnableFontSettings, EnableDoubleClick: BOOLEAN): INTEGER;
	{returns: 0=PIO does not verify, 1=Normal redraw, 2=Double-Click detected}
	VAR n,i: LONGINT;
BEGIN
PName := 'BAD'; PH := nil; PRH:= nil; PWH := nil; NewPio:=FALSE;
IF GetCustomObjectInfo(PName, PH, PRH, PWH) & (PH<> NIL) & (PRH<> NIL) THEN BEGIN
 	cVerPIO:=1;
	NewPIO:= IsNewCustomObject(PName);
	IF EnableDoubleClick & SetObjPropCharVs(3,CHR(1)) THEN BEGIN
		VsoGetEventInfo(n,i);
		IF (n=7) THEN cVerPIO:=2;
		END;
	SetObjectVariableBoolean (PH,800,EnableFontSettings);  
	END
	ELSE cVerPIO:=0;
END;


BEGIN  {<--Script Main Begin}
PushAttrs;
CASE cVerPIO(TRUE,TRUE) OF
	1: BEGIN 
		{*Draw Pio Code}
		END;
	2: BEGIN
		{*DoubleClick Code}
		END;
	END;
PopAttrs;
END;
This is a verification framework for PIO object.
It has options to set the PIO to respond to Font settings and Double-Clicks.
Also sets globals PH=Pio Handle, PioName=PIO Name, NewPIO=new PIO being created, etc.

2-10-07:
The Line that reset the active layer was removed in order to get PIOs to work in ViewPort Annotations and I'm guessing symbols as well. Since there is no "active layer" in VPAnnotation (returned NIL), the layer code was creating and switching to a new design layer and breaking the PIO.

IF (GetLayer(PH) <>NIL) & (ActLayer <>GetLayer(PH)) THEN Layer(GetLName(GetLayer(PH))); <--this was removed

In a previous VW version, if you edited a PIO while active layer was scale 1:10 and closed editor. The PIOs in the file would regenerate but PIOs on layers with different scales would have their text rewritten based on text size of the active layer. In VW11.5 this seems to be fixed.
But: for many PIOs I use the layer scale to determine some parameterswhere arrow size or margins or some other feature is based on points parameters. Just as size 12 text will appear the same size on layers of different scales, I felt that using points for some other parameters would help to make some PIO parameters less layer scale dependent. Basically I needed to know what is the dimension size of a point in any layer, or in the more difficult case...a ViewPort Annotation. My current solution is a small Function GetPtDimension.


DoubleClick: When doubleclick is detected the PIO code appears to run twice.
1st time through will run the DoubleClickCode.
2nd time will run the PioCode.
So you can change the PIO parameters with a dialog in the DoubleClickCode section and the PIO will automatically redraw the second time through.