; First, do a little bit of Blitz housekeeping NoCli WBStartup Findscreen 0 ; We need an intuition screen to open our window on. This simply uses the frontmost ; Now we'll set up a procedure to initialise the MUI window. Statement setmui{} MUIApplicationTitle "Lesson1" ;Sets the MUI application name MUIApplicationVersion "$VER: Lesson 1" ; Sets version information MUIApplicationCopyright "(c) 2001, Steve Hargreaves" ;Sets copyright information MUIApplicationAuthor "Steve Hargreaves" ;Sets Author information MUIApplicationDescription "Open an MUI window on the frontmost screen" ;And a description ; The above is equivalent to setting strings containing the information, and is used by Exchange and Version. MUIApplicationBase "LESS" ;This should be a unique identifier for your application ; We'll even add a tag to our application. For the full list of tags, see the MUIApplication autodoc MUIAddApplicationTags #MUIA_Application_SingleTask,True ; This just ensures that only one copy of our program is run at a time. ; Now we'll create an object to put in our window, just a little text label at the moment. MUILabel 1,"My MUI Window",#MUIO_Label_Centered ; OK, the parameters - The "1" is the MUI Object number, and must be unique (if it isn't, you'll ; probably get a crash) Then the text, since this is a label, it should say something ; And finally, any flags to apply to the object. The one used will centre the text in the window ; Most MUI commands follow a format similar to this. ;Now, we'll add this to our window (I know, we don't have a window yet - fear not, we will) MUICreateWindow 2,"My First Window","WIND1",1 MUIAddSubWindow 2 ; The MUICreateWindow command takes 4 parameters. The first is the unique object number, Then the ; window title, then a unique identifier, and finally the object group to be added. ; Since we only have one object, that's all we need. The MUIAddSubWindow command makes the window ; available to MUI. OK, That's it. Our window is ready. Now we'll initialise MUI itself:- If MUICreateApplication=False End EndIf ; If, for any reason, the MUI application fails to initialise, then the program will quit quietly. ; Now that we have our application prepared, let's set up notification, so that we know when the ; close gadget has been pressed MUINotifyApp 2,#MUIA_Window_CloseRequest,1,#MUIV_Application_ReturnID_Quit ; This now means that the window close event will be sent by MUI to Blitz. These are standard ; MUI constants, and don't need to be defined in advance End Statement ;Now we'll open our window and wait for it to be closed setmui{} MUIOpenWindow 2 ; This is all you need to open the window While ev.l>#MUIV_Application_ReturnID_Quit ev=MUIWaitEvent Wend MUICloseWindow 2 ; When the event is trapped, close the window End