Aros/Developer/Zune/Examples/Requester
Description
Sometimes it is necessary to open a MessageBox that gives a short Message to the user. That can be an error message or something like that.
For this purpose, there is ZUNE's MUI_Request.
Sourcecode
This is how it works:
#include <proto/exec.h> #include <proto/intuition.h> #include <proto/muimaster.h> #include <libraries/mui.h> int main (int argc, char **argv) { struct Library *MUIMasterBase = NULL; // open Zune (=MUI) library if (MUIMasterBase = (struct Library *) OpenLibrary("muimaster.library", 0)) { // create application and window, the root objects of any Zune application: // window need minimum content to open, so we add a TextObject Object *window; Object *app = ApplicationObject, SubWindow, window = WindowObject, WindowContents, TextObject, MUIA_Text_Contents, "Inside your window.", End, End, End; if (app) { // open window: set(window, MUIA_Window_Open, TRUE); // test if opening window was successful: IPTR open; get(window, MUIA_Window_Open, &open); if (open) { // show requester: MUI_Request(app, window, 0L, "MessageBox Title", "Close button text", "Your Message Text", // close window, and dump objects: set(window, MUIA_Window_Open, FALSE); } MUI_DisposeObject(app); } CloseLibrary(MUIMasterBase); } }
Note: In the above example, to save typing and get a clearer look, some C macros have been used (ApplicationObject, WindowObject, SubWindow, set(), and get()), which are defined in <libraries/mui.h>, see there for more C macros, and what Zune's macros actually do.
AROS native compiler command line
gcc [sourcefile] -lmui
Screenshot
And this is how it looks:
AROS version
This example tested with AROS of 2010-03-10.
Last modified on 17 July 2010, at 22:23