Sytze,

I tested this code and it doesn't have the problem. You might be getting a
dangling reference leaving one of the forms open, or a data session being
changed in an object that isn't going back correctly.

I did notice without setting the closable property, it was possible to close
the top level window before all the modal windows were closed.

Tracy

PRIVATE otoplevel
otoplevel = CREATEOBJECT("toplevel")
otoplevel.runform()

DEFINE CLASS toplevel as Form 
 caption = "Top level modal form testing"
 width = 800
 height = 600
 showwindow = 2 
 ADD OBJECT cmd1 as cmdLaunch 
 PROCEDURE runform
  this.Show()
  READ EVENTS
 ENDPROC 
 PROCEDURE error 
  LPARAMETERS nE, cM, nL
  MESSAGEBOX("Error: " + TRANSFORM(nE) + CHR(13);
   + "Message: " + MESSAGE() + CHR(13) ;
   + "Method: " + cM, 0, this.Caption)
  CLEAR EVENTS 
  RETURN TO MASTER 
 ENDPROC 
 PROCEDURE queryunload 
  CLEAR EVENTS 
 ENDPROC 
ENDDEFINE

DEFINE CLASS intop as form 
 caption = "Modal Form in Top Level"
 width = 400
 height = 300
 ShowWindow = 1 
 WindowType = 1 
 ADD OBJECT cmd1 as cmdLaunch
ENDDEFINE

DEFINE CLASS cmdLaunch as CommandButton 
 width = 75
 height = 23
 caption = "Launch"
 PROCEDURE click
  LOCAL modalform
  thisform.closable = .F.
  modalform = CREATEOBJECT("intop")
  IF this.Parent.showwindow = 1
   modalform.top = this.Parent.top + SYSMETRIC(9)
   modalform.left = this.Parent.left + SYSMETRIC(9)
   IF modalform.left + modalform.width > otoplevel.width ;
    OR modalform.top + modalform.height > otoplevel.height
    modalform.top = 0
    modalform.left = 0
   ENDIF 
  ENDIF
  modalform.Show()
  modalform = .NULL.
  thisform.closable = .T.
 ENDPROC 
ENDDEFINE


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/000b01c98173$507b9bb0$f172d3...@com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to