Using MUI in Blitz
Magic User Inteface (MUI) is a system developed to take the hard work out of designing a GUI for your application, leaving you to concentrate on the application itself. Nearly all aspects of an MUI interface can be customised by the user. The programmer mearly has to define the interface, and leave MUI to the task of controlling layout etc.
That's not to say that it's easy to use as a developer. In fact, MUI is like a programming environment itself, and during development it is easy to introduce conflicts between objects which will undoubtedly crash your system. It is important, therefore, to back up regularly whilst designing an MUI interface.
The basic system itself is object oriented, where each element of the GUI has its' own identification number, and each object can be set to react to user input in a variety of ways. In fact, it is possible to create an application using MUI almost exclusively, where all actions in the code become automatic depending upon what the user is doing. This, however, is beyond the scope of this tutorial, and should, in any event, only be tackled by advanced users.
The interface between Blitz and MUI is achieved using EFMUILib, which provides a limited number of commands. This does not mean, however, that use of MUI within your application is limited. The system can be used to its' fullest, and even new additions to MUI can be supported without updating the Blitz libraries.
Before you start, you should download the MUI developer archive. The autodocs within the archive are essential, though example code is aimed at C users, and is of limited value.
All examples in this tutorial will use standard MUI classes, but the principals for using custom classes are the same, and I will, of course, tell you how to access and use a custom class. Each time you install a new custom class, be sure to copy the autodocs too.
So, let's start with a small example, which will introduce you to initialising an MUI interface, and notification. If you run this small program, it will simply open an MUI window, and wait for you to close it again. Before you start, you will need to open the Compiler Options window in Blitz and add in the residents box "blitzlibs:mui.res" (without the quotes). If you have installed the MUI2.res, you can use that instead. You can find the mui2.res file as part of the EFMUILib.
OK, done that? Good, then we'll begin.
OK, so it's a lot of work, just to open a simple window. I know, and I agree. For such a simple window, you might as well use gadtools, and do the whole job in two or three lines. The real power of MUI comes into it's own when you are designing a more complex GUI. Already, in this simple example, you can't fail to have noticed that you haven't had to determine the size of the window, or set any flags to determine what gadgets are shown in the window border etc. In fact, you haven't worried about layout at all.
A full GUI can be created with the same disregard for layout, and considerably more quickly than Gadtools. It's also much easier to change an MUI GUI than it is a gadtools one.
The power of MUI is in it's notification and layout options. The MUINotifyApp command means that you can react to almost any event and any gadget with the minimum of fuss, so we'll have a closer look at that in the next section.
by Steve Hargreaves.
Installation | Troubleshooting | Programming | Archives | Links
Page last modified: 6th February 2002