How to recover from dragging a form's contents off-screen?

I’ve discovered that, if one is sufficiently ham-fisted, it’s possible to drag all of a form’s objects off screen. I can recover them in graphics mode and return to data mode but I don’t want to encourage a low-tech user to do that. My solution has been to save, close and re-open the file.

Is there a statement that will do the recovery?

I don’t understand the scenario you are describing. Form objects can only be dragged while in graphics mode, but it sounds from the description like this is something you are experiencing in data mode.

Perhaps you are talking about scrolling the entire form? (as opposed to dragging the individual objects) If the scroll bars are visible, you can use them to reset the scroll. You can also use the formxy statement to scroll the form, so prehaps just

formxy 0,0

is what you are looking for.

If the form has a text editor object, click in it and hold the mouse down, then drag the mouse right or down, off the screen. A form in Data Mode will scroll the opposite direction. If scrollbars are turned off, the user cannot readily scroll back to the proper position. A procedure on the form (I use a small grey rectangle for this) with a formxy 0,0 statement lets the user correct the misplaced screen contents.

This anomaly seems to only appear if all scroll bars for the Text Editor Object are turned off. Here is what the behavior looks like in action:


At first I was unable to duplicate these results. It turns out that another prerequisite before this will happen is that there must be more text than will fit in the Text Editor object. If not, the scrolling doesn’t happen. I’ve created a Bitbucket issue for this, but I would recommend that any Text Editor object that might contain more than one line of text should always have at least one scroll bar enabled. That’s good UI anyway and will also avoid this problem.

On further reflection, I’m not sure if this is even fixable. Apple’s text editor code is designed to auto-scroll in this situation. But if you don’t enable the scroll bar in the Text Editor object, the scrolling commands will automatically fall thru to the scroll controls for the form itself. This is automatic behavior, I don’t think it can be turned off. If you make sure that the Text Editor scroll bar is enabled, the problem doesn’t appear.

I think this may be related to what I said about maps, not clicking on the map moving the form, but if there are no scroll bars enabled on a form, you cannot move the form, and if only one scroll bar is enabled, the form will scroll in both directions. That is not what I would like. It may be an Apple issue.

One way to work around this is to have formxy 0,0 in the Procedure pane and End of Editing checked in the Procedure Trigger in the Options pane. Now all one has to do is click anywhere on the form which ends editing in the Text Editor Object and automatically moves the form back to the 0,0 position again.

There may be another. This is my TEO. The pop-up to the left puts a value into the same field.:


If I highlight the entry and drag it off screen, the objects all disappear to the left as in Gary’s video.

If I drag the contents of a stand-alone TEO the problem does not occur.

The problem also exists with a Text Display Object containing overflow text, no scroll bars and Allow Text Selection checked.