Mark, just to let you know that implementing the code to save the current window position works well from the queryCancel method. Thanks.

Now the problem is the reverse in a way. I have dialog A that does a popupAsChild of a PropertSheet dialog. What I want is that this dialog should position itself where it was when it was closed last time. So in the initDialog of class B, which is a subclass of PropertySheetDialog I do:

forward class(super) continue
self~moveWindow("top", x, y, "showwindow")

But I've found that 'forward' doesn't cause the window to show up, this doesn't happen until initDialog returns to the system. But moveWindow still gives return code .true. When the window shows up it is in it's 'normal', semi-random position.

So my question is, where should moveWindow be called from if initDialog is not the place?

Grateful for any help.


On Sun, May 18, 2014 at 1:20 AM, Staffan Tylen <> wrote:
Thanks Mark, I'll study the killActive method. I've already implemented a queryCancel method.

However, this statement of yours:

And leaving doesn't allow one to save the current state in a database, probably because of thread issues. 

doesn't make any sense to me. The leaving() method is the natural place to have your code:

::method leaving
  pos = self~propSheet~windowRect
  say 'PropSheet page leaving.  Window postion / size:' pos

which gives:

PropSheet page leaving.  Window postion / size: a Rect (50, 50, 427, 506)

There is no reason I can see why that won't work

Well, it works fine the way you have coded it but when I try to save the size and location of the window in an SQL database using an active ooSQLite connection things no longer seem to work that well. If I trace it the trace stops the moment I call the method to initiate the save and the database is never updated. I've so far been unable to track down what happens because my code looses control. I've tried running leaving without UNGUARDED but all in vain. Maybe killActive/queryCancel is the way forward in this case. I'll see if I can write a small sample program that illustrates what (doesn't) happen(s).