Switching to Graphics Mode and Back

Here’s one more thing I would change if I could. When switching to graphics mode, my form expands to takes up my entire screen, which is much too large. Ten times out of ten, I have to resize the window to something smaller. I wish the default were that it opened much smaller. Perhaps the size of the form plus room for the panes. Or it could use the Max/Min window sizes if they have been set to open slightly bigger than that.
And a related feature, when returning to Data Mode, it would always return to the Max Window Size if that is set for the form.

This has been an irritant for me from the start and I suggested the approach you mention of resizing to the size of the form in data mode plus room for the side Properties panel. I know Jim has mentioned that the form will automatically resize back to the original size if switched back to data mode as long as you have not resized it in graphics mode. I normally resize it because I don’t want it taking up my whole screen in graphics mode while I’m working on it.

I agree this is annoying. I usually try to keep my window sizes above the threshold whenever possible for this reason.

Currently if a window is below the minimum size to display the field properties panel, it zooms to full screen when switching to graphics mode. It zooms back to the small size when you switch to data mode. The ability to zoom to full screen and back is a feature built in to all windows in macOS, so this was possible to implement this way with minimal code.

Changing this behavior would require re-implementing Apple’s zoom code, but allowing it to zoom to a smaller size rather than to full screen. This is of course possible, but it would take quite a bit of time to do, it would definitely not be a 5 minute job (probably a couple of days? and possibly the sort of project that becomes a much larger task that estimated before hand.). There are so many other high priority projects, I don’t think it is worth setting something else aside to work on this right now, or probably for quite a while. But it is annoying.

If I ever do implement this, this is probably how it will work.

Do I smell Gary’s gears grinding coming up with a simple procedure to handle the desired window sizing when moving from Data to Graphics mode via a Procedure?

Hmm, nope it must be something else you are smelling. :poop:

In any database where I’m going to do a lot of moving between modes, I create a procedure called graphics like this:

graphicsmode
zoomwindow 23,200,1000,1500,"noscroll"

I then use that procedure to enter graphics mode every time. Saves a lot of frustration. You could easily improve it to read the window size and add a bit of width.

Michael, excellent idea. I just assumed, incorrectly, that once you went into graphics mode that you lost control of the window. Here is some additional code that will resize the window to its set max window size plus room for the panes, as you suggested.

if getformoption("","","MAXIMUMHEIGHT")=0 or getformoption("","","MAXIMUMWIDTH")=0
    beep
    alertsheet "Max Height and/or Max Width are not set for this form."+cr()+cr()+"Form name: "+info("Formname")
    return
endif

graphicsmode

zoomwindow
    getformoption("","","WINDOWTOPEDGE"),
    getformoption("","","WINDOWLEFTEDGE"),
    max(getformoption("","","MAXIMUMHEIGHT")+24,600),
    getformoption("","","MAXIMUMWIDTH")+300
zoomalign "top"

It only works if the Max Window size is set. The only negative is that the window opens full screen and then resizes. In an effort to avoid that behavior, I used a setwindow statement instead of zoomwindow followed by the graphicsmode statement. That did not work; the window did not open to the desired size.

That’s not what I am seeing on my 13" MBP, or it happens with forms only where the maximum height and width is not set in the form’s properties. Where I have set the maximum width, the window remains in its size (but includes the Properties bar now).

Ok, ok, I’ll put in my 2¢ as well. Here is a hotkey for the Command-Escape combination that will add extra space going into graphics mode if the form is under 450 pixels high or 600 pixels wide. Why those values? Well in my testing those were the points the change to graphics mode would go full screen. I’m sure this could use some further tweaking but seems to generally work pretty well.

definehotkeys "Global", "COMMAND-ESCAPE", |||If info("windowview")="Form"
    local WTop, WLeft, WHght, WWidth
    global startWindowRec
    startWindowRec=info("windowrectangle")
    GetWindow WTop, WLeft, WHght, WWidth
    zoomwindow WTop,WLeft,max(450,WHght),?(WWidth < 600,780,WWidth)
    graphicsmode
Elseif info("windowview")="Draw"
    datamode
    zoomwindowrectangle startWindowRec
Else
    beep
Endif|||

You can set the hotkey combination to whatever works best for you as long as it does not interfere with an existing keyboard shortcut or hotkey.

I wish I had raised this issue a long time ago, because these solutions are excellent and do exactly what I wanted. Thanks Gary and Michael for your contributions.