Nested forms with Showmodal in Win32/OSX

237 views Asked by At

I have a situation where I have 3 forms. I open Form2 from Form1 and Form3 from Form2

Form2 is shown as ModalForm, Form3 is not.

When I run this project in Windows, I can switch between Form2 and Form3 but I cannot go back to Form1 before I close Form2 (as expected).

In OSX, Form3 is opened behind Form2 and cannot be accesed(not expected) until I close Form2.

What is the usual design philosophy for Multi-platform projects?

Should I always open Childform in same state as parentform if the parentform is Modal?

1

There are 1 answers

0
David Schwartz On BEST ANSWER

I'd set this up where the non-modal form (Form3) is opened from the main form (Form1). That way, there's no question about its parentage. I'd put a method into Form2 that's initialized from Form1 after it creates Form2 but before it calls ShowModal that Form2 uses to open Form3. Include any parameters in the call that Form2 needs to pass into Form3.

This approach eliminates the explicit circular reference between Form1 and Form2 and keeps Form3 independent of Form2.