I grabbed this messagebox function from one of the reaction examples provided with the OS4 SDK. It works great, but only has one button. It looks like it should support multiple buttons and button texts, but I can;t figure out how I need to call it to do something like getting a requester that has both a "Delete" and "Cancel" button, returning a different value for each.
Here is the reaction code from the examples on the SDK:
Is there an easy way to modify this to accept two buttons and their text, or does it need a rewrite? Also, is there a way to add an image to a button easily?
Thanks!
uint32 MessageBoxA(char *gadgets, char *format, APTR args ) { Object *requester; char buffer[512]; uint32 result = 0; memset(buffer, 0, 512); IExec->RawDoFmt(format, args, NULL, buffer); requester = IIntuition->NewObject(IRequester->REQUESTER_GetClass(), NULL, REQ_Type, REQTYPE_INFO, REQ_TitleText, "Auto Sample", REQ_BodyText, buffer, REQ_GadgetText, gadgets, TAG_DONE); if (requester) { result = IIntuition->IDoMethod( requester, RM_OPENREQ, NULL, NULL, NULL ); IIntuition->DisposeObject(requester); } return result; } uint32 VARARGS68K MessageBox(char *gadgets, char *format, ...) { va_list ap; LONG result; va_startlinear (ap, format); result = MessageBoxA(gadgets, format, va_getlinearva(ap,void*) ); va_end(ap); return result; }