V2.4.1 How to Normalize document?

Hello,

I have the following problem, with my multi-document application.

While moving (example, left and top) nodes in a View, I extend the Document bounds (example x=-1000.0, y= -1000.0, w=…, h=…). Perfect.

When I create a new document, bounds are x=0.0, y= 0.0, w=…, h=…).

So, when I copy-paste items from a document to another, the paste position occurs far from the position expected by user.

Is there some simple way to “Normalize” position of document items to have the top-left item located at x=0 and y= 0 in the document ?

Thanks

(Sorry for poor English)

You can hook the ClipboardPasted event on the view and do an appropriate MoveSelection.

Note that samples like FlowCharter do something like this in Paste_Command for pasting from a context menu (except you don't have to call EditPaste if you are hooking ClipboardPasted).

Thanks Jake,

Well… copy-paste problem is just one example…

My question is:
“How to “Normalize” position of document items to
have the top-left item located at x=0 and y= 0 in the document ?”

I do not need that the document “normalize” itself all the time. I just need the code to execute against à document to do the job when needed.

Thanks

Some advise, anyone?

Thanks

Stephane

Sorry for the delay.

Call GoDocument.ComputeBounds to figure out the rectangular area where there are document objects in your document. The rectangle’s position will tell you how far away from the origin things are, and then you can figure out how far you’ll want to move things.

Then it’s easiest to call GoView.SelectAll, GoView.MoveSelection, and then GoView.Selection.Clear() to deselect everything.

Works well.

Thanks Walter

Regards

Stephane