Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Aros/Developer/Zune/Examples/Requester

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

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", NULL); // 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: Image:Aros MessageBox.jpg AROS version This example tested with AROS of 2010-03-10.