RE: OpenAux (view: View; title: Title)

From: [at]} <johansson{>
Date: Tue, 20 Feb 2001 13:48:46 +0100

Hi Doug,

the main approach of BlackBox is to program without using windows. The
View-abstraction is the central abstraction and the idea is that this should
be enough for most applications. Since a view can be opened in several
windows at the same time, this does not comply with the more classical
window-centered programming. A view can also be part of a document, in which
case "closing" a view does not make any sence.

It is clear that the View-abstraction does not work in all cases but in our
experience it is often possible to redesign an application so that it no
longer needs to use windows. This often leads to a more flexible application
without modal windows or other limitations.

The main design model is that programs create and manipulate documents,
which are shown to the users. Users may manipulate documents further, maybe
with the help of other programs (i.e. commands). If the user decides that a
document is not needed anymore, he or she can decide to close the window
displaying it.

So, the first advise would be to look closely at your application and try to
find a different approach where you no longer need to handle windows and
instead can focus on the views in your application.

If it is not possible to redesign your application you will have to use the
Windows-abstraction in BlackBox. This is not documented, for the reasons
given above and also because it is a non-portable module. But, as seen in
the other replies to this topic, it is pretty straight forward to use.

Both suggested solutions would be used by us in such a case, but we do have
a small safety correction to the solution suggested by Helmut Zinn.
StdCmds.OpenAux can fail and this leads to that the wrong window is returned
by Windows.dir.Focus(TRUE). So it is better to use StdApi.OpenAux, which
lets you react if OpenAux fails. Here is our suggetion of how to find the
right window:

MODULE PrivWin;

        IMPORT StdApi, Windows, Views;

        VAR win: Windows.Window;

        PROCEDURE Open*;
                VAR v: Views.View;
        BEGIN
                StdApi.OpenAux('Text/Rsrc/Cmds.odc', 'Find', v);
                IF v # NIL THEN
                        win := Windows.dir.Focus(TRUE)
                ELSE
                        win := NIL
                END
        END Open;

        PROCEDURE Close*;
        BEGIN
                IF win # NIL THEN Windows.dir.Close(win) END;
                win := NIL
        END Close;

END PrivWin.


Regards,
Bengt Johansson, Oberon microsystems

> -----Original Message-----
> From: Danforth, Douglas [mailto:DDanforth{([at]})nowhere.xy
> Sent: Montag, 19. Februar 2001 21:25
> To: 'blackbox{([at]})nowhere.xy
> Subject: OpenAux (view: View; title: Title)
>
>
> Folks,
>
> What is the proper way to close a window under program control?
>
> Views.OpenAux(view, title) creates a visible instance.
> How does one close that instance *without* handling a message?
> (One is not permitted to use the mouse to click the window).
>
> (Normally I would expect something like:

> frame/handle/document := Views.OpenAux(view, title);
> combined with a symmetric call of
> Views.CloseAux(frame/handle/document)).
>
> -Doug
>
> ---
> Douglas G. Danforth, Ph.D. - Research Scientist
> QuikCAT.com 6700 Beta Drive, Suite 200, Mayfield Village, OH
> 44143-2335
> danforth{([at]})nowhere.xy
> --------------------------------------------
>
> To unsubscribe from this mailing list, send a message containing
> the word "unsubscribe" to:
> blackbox-request{([at]})nowhere.xy
>
> To get a list of valid e-mail commands and instructions on their
> usage, send a message containing the word "help" to the above address.
>
> Send any problem reports or questions related to this email list
> to the list owner at
> owner-blackbox{([at]})nowhere.xy
>

--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy
Received on Tue Feb 20 2001 - 12:48:46 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:44 UTC