Jump to content
Developer Wiki and Function Reference Links ×

the simple undo!?


MaxStudio

Recommended Posts

Have a look at putting begincontext and endcontext around the area that you want to treat as a whole entity. It works similar to database commits where you can rollback a whole set of commands if any single operations fails, but it may do the trick for you too if you set the 'undo click' to endcontext(0) - rollback.

That said, a script is treated as a single operation, so running a script, then hitting undo will remove everything created under the script.

PROCEDURE test;

VAR 
pt : POINT;

BEGIN
BeginContext;

Rect( 1000, 1000, 1500, 1500 );
Rect( 2000, 2000, 2500, 2500 );
Rect( 3000, 3000, 3500, 3500 );

GetPt(pt.x, pt.y);
IF ( pt.x < 1000 ) OR ( pt.y < 1000 ) OR ( pt.x > 3500 ) OR ( pt.y > 3500 ) THEN
	EndContext(0)
ELSE
	EndContext(1);
END;

RUN( test );

The above shows the use of the context - it will create 3 'ghosted' rectanges, but not 'commit' them until you click within the bounds of the cluster. If you click outside the bounds, the operation within the context will be rolled back - ie, treated as it had not occurred.

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...