[q] Modal dialogs (not working ?)

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Sun Sep 7 19:39:23 UTC 2003


On 07/09/03 10:57, "Bob Arning" <arning at charm.net> wrote:

> On 07 Sep 2003 11:02:02 +0200 Martin Drautzburg <martin.drautzburg at web.de>
> wrote:
>> Bob Arning  <arning at charm.net> writes:
>> 
>>> On 07 Sep 2003 02:14:10 +0200 Martin Drautzburg <martin.drautzburg at web.de>
>>> wrote:
>>> 
>>>> FileList2 modalFileSelector opens a dialog, but I can do all sorts of
>>>> other things like  raise a window or open the WorldMenu. I was
>>>> thinking that "modal" means that this should not be possible. What am
>>>> I missing ?
>>> 
>>> It means simply that whatever bit of code requested the dialog is suspended
>>> until an answer is received from the dialog. Everything else continues as
>>> normal.
>> 
>> Okay I understand that the world menu works. But how can I block an
>> "application" until the modal dialog has exited ? I mean like
>> evenything that is in a SystemWindow.
> 
> Some possible answers are...
> 
> 1. Don't. Ask yourself if you really need to prevent the user from doing these
> things. Without knowing your application, I cannot tell if this answer could
> work for you.
> 
> 2. Define an application. If the various UI elements know what application
> they belong to, then it may be possible for the application to notify them
> when it is ok/not ok to do certain things.
> 
> 3. Block everything. When you want a dialog to be truly modal, open a
> world-sized transparent morph beneath it and arrange for the transparent morph
> to consume all mouse clicks and key presses outside the dialog.
> 
> Cheers,
> Bob
Martin:
And besides Bob excelent advice  you still want have a SystemWindow with
fields, buttons, etc you could do:

Your code hier

[done]
                whileFalse: [World doOneCycle].

You should have a method like
 endDialog: aDialog
 aDialog delete.
done _ true.

Triggered by a (SimpleButtonMorph new label: 'END';
             target: self; "hier I suppose you get appropiate code in self
class "
             actionSelector: #endDialog;
arguments: (Array with: aDialog).

See code in FillInTheBlankMorph .

And if you still having trouble, draw exactly how your dialog is , send a
gif or jpg to me and I cook for you !!!

Cheers.
Edgar



More information about the Squeak-dev mailing list