Jump to content

Hello Community!

This Saturday, April 11, from 9am – 1pm EDT we will be performing maintenance on the Vectorworks Community Board. During this time, the site will be unavailable.

Sign in to follow this  
DeSignature

PIO Button in OIP

Recommended Posts

... still trying to store data in record-fields ...

The data actually passes to record fields but are being reset when re-entering the dialogue via the "Button 1"-dialogue. Am I missing a loop somewhere?

PROCEDURE Point_Object;
CONST
Confirm					= 01;
Cancel					= 02;
Reset_PIO				= 03;
k_Icon					= 05;
PIO_Controls_Palette	= 08;
k_Palette_Button		= 35;
VAR
PIO_N				: STRING;
PIO_H, PIO_R, PIO_W	: HANDLE;
Event, Result		: LONGINT;
Bool				: BOOLEAN;
Dial_ID, Dial_Res	: INTEGER;
D_X, D_Y, D_Z		: REAL;

PROCEDURE Result_A;
BEGIN
	IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN
	BEGIN
		Rect (0, 0, pD_A, pD_B);
		Message (GetRField (PIO_H, 'Rec_N', 'Data X'));
	END;
END;

PROCEDURE Result_B;
BEGIN
END;

PROCEDURE Records;
BEGIN
	NewField ('Rec_N', 'Data X', Concat (D_X), 9, 0);
	NewField ('Rec_N', 'Data Y', Concat (D_Y), 9, 0);
	NewField ('Rec_N', 'Data Z', Concat (D_Z), 9, 0);
END;

PROCEDURE Dialogue_A;
	PROCEDURE Layout_Dialogue_A;
	BEGIN
		Dial_ID		:= CreateResizableLayout ('Dialogue A', TRUE, 'Confirm', 'Cancel', TRUE, TRUE);
			CreateCheckBox		(Dial_ID, 100, 'Do Something');
			CreateStaticText	(Dial_ID, 110, 'Data X:', 20);
			CreateEditReal		(Dial_ID, 111, 3, D_X, 20);
			CreateStaticText	(Dial_ID, 120, 'Data Y:', 20);
			CreateEditReal		(Dial_ID, 121, 3, D_Y, 20);
			CreateStaticText	(Dial_ID, 130, 'Data Z:', 20);
			CreateEditReal		(Dial_ID, 131, 3, D_Z, 20);

			SetFirstLayoutItem	(Dial_ID, 100);
			SetBelowItem		(Dial_ID, 100, 110, 0, 0);
			SetRightItem		(Dial_ID, 110, 111, 0, 0);
			SetBelowItem		(Dial_ID, 110, 120, 0, 0);
			SetRightItem		(Dial_ID, 120, 121, 0, 0);
			SetBelowItem		(Dial_ID, 120, 130, 0, 0);
			SetRightItem		(Dial_ID, 130, 131, 0, 0);
	END;

	PROCEDURE Dialogue_A_Handler (VAR Item, Data: LONGINT);
		PROCEDURE Dialogue_A_Settings;
		BEGIN
			Bool	:= GetEditReal (Dial_ID, 111, 3, D_X);
			Bool	:= GetEditReal (Dial_ID, 121, 3, D_Y);
			Bool	:= GetEditReal (Dial_ID, 131, 3, D_Z);
		END;

		PROCEDURE Confirm_Handler;
		BEGIN
			IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN
			BEGIN
				Bool	:= GetEditReal (Dial_ID, 111, 3, D_X);
				Bool	:= GetEditReal (Dial_ID, 121, 3, D_Y);
				Bool	:= GetEditReal (Dial_ID, 131, 3, D_Z);

				AlrtDialog (Concat (D_X));

				SetRField (PIO_H, 'Rec_N', 'Data X'	, Concat (D_X));
				SetRField (PIO_H, 'Rec_N', 'Data Y'	, Concat (D_Y));
				SetRField (PIO_H, 'Rec_N', 'Data Z'	, Concat (D_Z));
			END;
		END;

		PROCEDURE Cancel_Handler;
		BEGIN
		END;
	BEGIN
		CASE Item of SetUpDialogC: Dialogue_A_Settings;
			01	: Confirm_Handler;
			02	: Cancel_Handler;
		END;
	END;
BEGIN
	Layout_Dialogue_A;
	IF VerifyLayout (Dial_ID) THEN Dial_Res := RunLayoutDialog (Dial_ID, Dialogue_A_Handler);
END;

PROCEDURE Dialogue_B;
BEGIN
	AlrtDialog ('Here''s nothing going on');
END;

BEGIN
vsoGetEventInfo (Event, Result);
CASE Event OF
	k_Icon:
	BEGIN
		Bool	:= SetObjPropVS (PIO_Controls_Palette, TRUE);
		Bool	:= vsoInsertAllParams;
		Bool	:= vsoAppendWidget (12, 100, 'Button 1', 0);
		Bool	:= vsoAppendWidget (12, 200, 'Button 2', 0);
	END;

	k_Palette_Button:
	CASE Result OF
		100:	Dialogue_A;
		200:	Dialogue_B;
	END;

	Reset_PIO:
	IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN
	BEGIN
		PushAttrs;
			Result_A;
			Result_B;
			Records;
			Record (PIO_H, 'Rec_N');
		PopAttrs;
	END;
END;
END;
RUN (Point_Object);

Share this post


Link to post

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.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...