Problem with a dialog losing parent?

dayv2005

Member
Ok to better explain this, I have Window1.w calling Window2.w calling Dialog3.w.

Example:

Window1.w --> Window2.w --> Dialog3.w

When I close Dialog3.w sometimes Window2.w moves to the top like it should and becomes the active window. Then again sometime when I close Dialog3.w, Window1.w moves to the top and becomes the active window.

To me it seems like Dialog3.w is unsure of it's parent or who called it. It there a way I can explicitly make sure that every time Dialog3.w is closed that only Window2.w moves to the top or becomes the active window?

Here is how I am calling Dialog3.w from Window2.w:

Code:
DEFINE VAR ProcedureHandle AS HANDLE NO-UNDO.


FIND Company WHERE CompanyID = fCompID NO-LOCK NO-ERROR.


RUN Dialog3.w PERSISTENT SET ProcedureHandle 
  (OUTPUT o-RecID, 
  OUTPUT o-ReturnCode, 
  OUTPUT o-CBSalesmanID,
  INPUT IF AVAILABLE Company THEN ROWID(Company) ELSE ?).
 

dayv2005

Member
What ended up fixing this issue was changing this code in the MAIN-BLOCK:

Code:
/* Parent the dialog-box to the ACTIVE-WINDOW, if there is no parent. */
IF VALID-HANDLE(ACTIVE-WINDOW) AND FRAME {&FRAME-NAME}:PARENT eq ? THEN 
FRAME {&FRAME-NAME}:PARENT = ACTIVE-WINDOW.

to this...

Code:
/* Parent the dialog-box to the ACTIVE-WINDOW, if there is no parent.   */
IF VALID-HANDLE(ACTIVE-WINDOW) AND FRAME {&FRAME-NAME}:PARENT eq ? THEN 
DO:
    PROCESS EVENTS.
    FRAME {&FRAME-NAME}:PARENT = ACTIVE-WINDOW.
END.

works perfect now.
 
Top