Hi
How do I bring a sheet to front in MDI, with focus and drawing, as the selection via the Window menu bar would?
I am updating this application's task launcher so that when a task opens a sheet but it is already open, the sheet is brought to front.
I've tried wSheet.BringToTop = True (where wSheet is the sheet reference), it brings it to the front, but the focus is not automatically given to the sheet, and sometimes (when sheets are not in maximized mode) the sheet is not redrawn and the underlying sheet is shown.
When changing between sheets using the Window menu bar, the sheets focus is restored to where it last was, and the sheets are drawn properly, and that is ideal behavior.
Cheers, Peter.
Calling wsheet.SetFocus() does work to bring it to front and focus it as needed.
In this applications case, the windows are opened from treeview click events, and for some reason it is interfering with focusing and redrawing. (Which has really confused my debugging of the problem).
So to force a redraw, i have worked around by calling wsheet.SetRedraw(true).
And to workaround the treeview interfering with focus, I have put the calls to setfocus and setredraw into a function and calling it by the "Post Function" mechanism, which seems to allow these to execute after the treeview click event has processed.
I don't know why the treeview is interfering, but at least the workaround appears to work.
Cheers, Peter.
Super glad that the SetFocus() command worked for you. Yes, you often need to POST an Event or Function to let the other PowerScript's "in progress" complete before setting focus - so that the normal flow of the App is not disturbed.
Regards ... Chris
wsheet.BringToFront = TRUE