Notification in Blitz | |||
|
OK, the "real" interface between Blitz and MUI can actually be narrowed down to just three commands, MUIAddTags, MUIDoMethod, and MUINotifyApp. MUIAddTags does just as it says, it adds MUI tags to MUI objects. You'll find as you use MUI that almost the entire thing is controlled with tags. Some of the tags are fairly general, and some are specific to particular types of object.A full list and explanation of them all is well beyond the scope of this tutorial. You can, however, get all details from the MUI autodocs, which you should always keep handy when programming for MUI. The MUIDoMethod command actually sends a "command" to MUI, to have it do something. Again, this is very much tag orientated, and again, having the MUI autodocs handy is a must. And finally, the MUINotifyApp command. Without this, it would be impossible for your Blitz code to react to MUI. Your code would just sit and wait for something which would never arrive. So what does it do exactly? Well, if you have used Blitz to program anything that gets input from the user (other than Edit and Edit$), for example, a gadtools button being pressed, then you will be aware that the WaitEvent command will report the most recent event code to you. The MUI equivalent is MUIWaitEvent. This command does not, however, report any event. It will only report those that you tell it to. If you want to test this, you can. Using the last example, comment out the line starting with MUINotifyApp, and then compile and run it. Now, you can't close the window, and your program is stuck in an endless loop. Chances are you'll have to reboot to get your system back, so off you go and reboot to get rid of your little test program and bring Blitz back to life. You can add notification to almost any Blitz object, and you do it in a variety of ways. This example will show you how to set up a basic notification in MUI. First, you need an image. Load up your favourite paint package, and draw a small image to use on your button, then save it to disk. Done that? OK, now compile and run the following code, remembering to change the path in im$ to the path and filename of your newly created image. It's possible that, when you run this, the window will be too small to show the close gadget. If so, go to the debugger and click "Stop", then return to the window and click in it. Finally, close the debugger. This depends on the size of the image used for the button. All the example does is a standard BeepScreen when the button is pressed, and closes the window if the close gadget is pressed. Since these are the only events we are interested in, these are the only ones that are reported to your program. Any other events are ignored. However, MUI notification can do more than this, as the next section will demonstrate.
| |||
|
Installation | Troubleshooting | Programming | Archives | Links Page last modified: 6th February 2002 |