Is there a way to force a window as the front most window of the app without setting it to a (global) floating window?
BTW macoS only
I think that this will work for you.
soft declare sub addChildWindow lib "Cocoa" selector "addChildWindow:ordered:" (parentWindow As Ptr, childWindow As Ptr, level As Integer) addChildWindow(Ptr(Self.Handle), Ptr(Window2.Handle), 1)
It will make Window2 a child of the window that you call it from and will order it to be on top.
That child window will always be on top of the parent window, but not on top of other applications.
A side effect (not sure if it's desired or not) is that the child window follows the parent window if you move it.
do I need to 'detach' the window when closing Window2?
I believe that you can just close Window2 without needing to do anything else, but if you do want to unlink them you can use:
soft declare sub removeChildWindow lib "Cocoa" selector "removeChildWindow:" (parentWindow As Ptr, childWindow As Ptr) removeChildWindow(Ptr(Self.Handle), Ptr(Window2.Handle))
So I finally got back to this declare
dim window2 as new LilDWindow soft declare sub removeChildWindow lib "Cocoa" selector "removeChildWindow:" (parentWindow As Ptr, childWindow As Ptr) removeChildWindow(Ptr(Self.Handle), Ptr(Window2.Handle))
I did have to make it as an implicit instance, but it is window(0) finally.
I unfortunately didn't have it saved and recovery didn't have it in there and it took me until now to realize it was missing.
It works but for 2 problems.
1. No matter what I do the titlebar doesn't show the window has focus. I have this problem with another window.
2. The menuitem for close on the calling window is called. Yes I have stuff like menuhandlers and the same menubar.
I modified your original project and re-uploaded it for you to take a look at.
When I run this project, clicking the on the child window focuses that window (the titlebar shows the focus) and then using the menuitem to close will properly close the child window while it is focused.
Thanks, Jared. Didn't think I would have to click on it to get it in focus. I can live with that.
On my own application, the enableMenuItems doesn't run consistently. (I saw FileClose once and not since)
I even tried putting FileClose.Enabled = True in the window's open and it still didn't show.