ndow display. anIcon evaluate ---------------------------------------------------

The active window will display an icon with 'Engi Browser' as text with a gradated-pastel-color background for a 256 color monitor (or just white for black and white monitor). (To see how the image is created, take a look at EngiLauncherIcon class>private>backgroundImage:)

Now you know how to make icons to serve as background for the Launcher labels. Program 38-4 creates a launching window for you click an icon of Engi Browser in it.


Program-38-4: (EngiLauncherIcon, EngiLauncherModel;)
---------------------------------------------------
| aLauncher anIcon |
aLauncher := EngiLauncherModel new.
anIcon := EngiLauncherIcon
                        extent: 100 @ 30
                        title: 'Engi Browser'
                        image: nil
                        action: 'EngiBrowser open'.
aLauncher addIcon: anIcon at: Point zero.
aLauncher open
---------------------------------------------------

The program (1) creates an instance of a launcher model (2) adds an icon to the model specifying it's coordinates (3) sends 'open' to the model. You can change 'open' to 'popUp' to pop up an icon rather than creating a permanent window.

Or you can use 'launch' to have a choice between 'open' or 'pop up' by pressing the shift key just after 'do it'.

Of course the point is to store more than just one button in the Launcher. Program 38-5 shows how to use the 'pressIcon:' message to programmatically invoke the action associated with a button. The argument is the button label string.


Program-38-5: (EngiLauncherIcon, EngiLauncherModel;)
---------------------------------------------------
| aLauncher anIcon |
aLauncher := EngiLauncherModel new.
anIcon := EngiLauncherIcon
                        extent: 100 @ 30
                        title: 'Engi Browser'
                        image: nil
                        action: 'EngiBrowser open'.
aLauncher addIcon: anIcon at: Point zero.
aLauncher pressIcon: 'Engi Browser'
---------------------------------------------------

Let's shift the topic to the view and controller. The launcher has it's own view but it uses 'EngiDisplayController' rather than it's own controller because special one is not necessary. Also 'EngiDisplayView' would work for the launcher, but I made a custom view for the pop up launcher. 'EngiLauncherView' has an instance variable to store a Boolean object named 'popUp'. The variable keeps track of whether the window is resident or just a popUp. 'EngiLauncherPreemptor' is a controller for the top window of the pop up launcher. This controller is special in that it does not give up control until the mouse cursor leaves the window.

I specialized the launcher for the Engi system. Notice the following five messages in the public category of 'EngiLauncherModel' class.

-------------------------------------------------------------------
launcherOfEngiSystem  Main launcher for the Engi system
launcherOfEngiTools   Launcher to start tools of the Engi system
launcherOfBrowsers    Launcher for browsers
launcherOfUtilities   Launcher for utilities
launcherOfChanges     Launcher for changes
launcherOfSpecials    Launcher for special processes
-------------------------------------------------------------------

The first time you create a launcher, it will take a little while to build the background images for the buttons. But subsequent creations should not take long, because the images are cached in the class. You can use the Engi launcher instead of the standard launcher. Or you can easily create a new launcher. Try to make your own launcher with more visual icons.


parent previous next question
Copyright (C) 1994-1996 by Atsushi Aoki
Translated by Kaoru Rin Hayashi & Brent N. Reeves