Can't find replacement for WindowToBack

Is there no equivalent to the WindowToBack statement in PanX? I have several databases with multiple windows and an invisible button calling a procedure to send the window to the back is very handy.

It is on the list, but WindowToBack is not available yet.

It’s a little flashy, but it works.

Local x x = arraytrim(arrayreverse(info("windows"),¶),1,¶) arrayfilter x,x,¶,{window "}+import()+{"} execute x

Thanks Jim

Reviving an old thread… the windowtoback sends the window to the back of ALL open windows including non Panorama windows. In Pan 6 it would send the window only to the back of the open database. So far is there no command to send the window only to the back of the open database?

In Pan 6 WindowToBack sends the active window behind all open windows regardless of what database they belong to. It does not move it behind just the database to which it belongs.

But whether it’s one window back or many should make no difference in what you’re doing within the current window.

If your reason for concern is for any easy return to the window you’ve sent to the back, RememberWindow and OriginalWindow are easy, regardless of where your first window has ended up in the window order.

No, not that I know of. You can force things in a rather heavy handed way however. This rather crude method will send the front Panorama X window to the rear of all other Panorama windows and all Panorama windows will be in front of any other non-Panorama windows. If there are more than one database open with other windows they will be kept in the same order as originally set except the old front window will now be at the rear of all the other Panorama windows.

looparray arrayreverse(arrayrange(info("windows"),2,-1,¶)
    +¶+array(info("windows"),1,¶),¶),¶,element,index
    window element
    If error nop endif
endloop

There is of course the flashing of the windows as they are reordered which is why I described the method as crude.:disappointed:

We don’t know the actual objective, but if it’s to move the active window back by one window to activate the next window in the layer of windows there’s a simple method for that without flashing.

ListWindows(“”) lists the open windows in their order.

This seems to be the solution for that:

Let lvWindows = listwindows("")
Window array(lvWindows,2,¶)

If list windows( is set to use the active database name, the procedure would bring the next open window within that database forward regardless of how deeply buried it is.

The objective is simply to move the frontmost window to the rear, if it’s to the rear of all Panorama windows that’s OK, I just don’t want it behind non-Pan windows. I’d like it to function the way it always has in the past.

IIRC Apple changed its ‘normal’ behavior from grouping all of each application’s windows together in the overall window order, wherein clicking on one would not only bring that to the front but would also bring its mates forward as a group, to a ‘normal’ where all windows were treated and moved separately multiple OS releases back. And I’m running High Sierra so my impressions are two versions behind current. I haven’t run Pan6 much for a couple years so my memories of its fine points are blurred as to whether it ran the old way. Maybe its Carbon roots let it keep running that way, whereas newer (by a couple decades) Cocoa apps stick with Apple’s new paradigm, like it or not. As Carbon is dead in Catalina, barring emulation such as Parallels, PanX can’t use what’s not there. And PanX can’t directly touch other applications, such as changing the order of their windows, as probably would be needed to overcome Apple’s new norm. That’s been verboten for years.

I haven’t used such for a few years, but there used to be some third party apps that could rearrange multiple apps window positions and orders. I don’t know whether any of them are still available and working. Depending on what I’m doing sometimes I like the new behavior, and sometimes I miss the old, but I remember that not only has Panorama changed, but the control freaks in Cupertino have significantly changed the environment under which it runs. One of their changes which might somewhat help you would be to use Spaces. Do all your Panorama X work on one Space and other apps in other spaces. Then you won’t be tripping over other apps’ windows. Spaces adds different hassles, but can help manage window clutter.

I doubt this will change since it probably doesn’t affect most folks and would normally never even be noticed. John mentions the reason for implementing the windowtoback statement the way that Jim has and the documentation clearly points out the difference when other application windows are involved.

That being said, there is an item in the Window menu called “Bring All to Front” which will bring all the Panorama windows to the front in their existing order, position and size (like John, I’m stuck in High Sierra because of my old equipment so I can’t test this beyond that). You could assign a keyboard shortcut to this item in the System Preferences Keyboard panel under Shortcuts. Click the + box, select PanoramaX.app for the Application, enter your Keyboard Shortcut and the Menu title “Bring All to Front” (without the quotes). Now you can be sure all the Panorama widows are front most of any other background application with a click of the keyboard.

AppleScript can easily be added to bring all Panorama windows to the front without changing their order:

applescript |||
tell application "PanoramaX"
activate
end tell
|||

Leo, while it is possible to have other application’s windows mixed up with Panorama windows — whatever you, the user, happened to arrange —, Panorama has no feature to rearrange other application’s windows. It does not know anything about those windows. Off course, Panorama is able to (re-)arrange its own windows.

(As already was pointed out, it is easy in macOS to rearrange all windows of one application in one Space/Desktop. YOU can keep your applications on separate spaces and avoid mixing them on one screen.)

Panorama’s windowtoback statement just puts the window with the given name behind the last Panorama window. It is irrelevant how many other app’s windows are accidentally mixed between Pan’s windows.

This statement has been carried over from Panorama 6 without any changes.

Not quite accurate. In Panorama 6 it will put the window behind the last Panorama 6 window and in front of any othe application windows that might be further back. In Panorama X it will put the window behind ALL other windows regardless of what application they belong to. These actions are mentioned in both the Pan 6 Reference file and the change is noted in the Panorama X Help file.

image

I’ve apparently been ignoring the presence of Bring All to Front for years; it’s a good trick!. From Apple’s Human Interface Guidelines:

Brings all of the app’s open windows to the front, maintaining their onscreen location, size, and layering order. (This should also happen when the user clicks the app icon in the Dock.) Changes to Arrange in Front while pressing the Option key. Arrange in Front also brings all of the app’s open windows to the front, but tiles them neatly.

Doing one of the ways to send a PanX window to the back, followed by one of the ways to trigger Bring All to Front, should accomplish what Leo wants. They could currently be combined as a procedure, doing the latter via the AppleScript, and given a hotkey. I think it could be setup to be automatically available for all databases, although I’m not sure just how. Maybe as a custom statement…

I suspect, since the implementing code is already there, Jim could fairly easily add PanX statements to trigger Bring All to Front and Arrange in Front without needing AppleScripts.

Unfortunately there is a bug in AppleScript that comes up when trying to open a menu item by name using the applescript command. If I run this in the Script Editor it will work perfectly:

applescript |||
tell application "PanoramaX"
	activate
end tell
tell application "System Events"
	tell process "PanoramaX"
		tell menu bar 1
			tell menu bar item "Window"
				tell menu "View"
					click menu item "Bring All to Front"
				end tell
			end tell
		end tell
	end tell
end tell
|||

If this is run from a procedure using applescript it gives an error Can’t get menu bar 1 of process “PanoramaX”. Invalid index.. This type of error has cropped up in other applications and has been known for some time with no work-around that I could find. In a previous thread I showed a way to use an AppleScript keystroke to trigger a menu shortcut to activate a menu item but Bring All to Front does not have a shortcut attached to it by default.

Not the case at all in Pan X. In Pan X it moves the window behind any and all windows open, irregardless if they are Pan X or anything else. This is why I brought it up in the first place.

Here’s the actual Objective-C code in Panorama for implementing this action:

NSWindow * backWindow = [targetController nsWindow];
[backWindow orderWindow:NSWindowBelow relativeTo:0];

Here’s Apple’s documentation for the orderWindow:relativeTo: method:

Here’s the key passage from this documentation page:

Pass 0 to place the window in front of (when place is NSWindowAbove ) or behind (when place is NSWindowBelow ) all other windows in its level.

Leo, if you don’t like the way this works, please take it up with Apple. The way to do that is to file what’s called a “Radar”, then your request can be ignored like everyone else’s.