struct orRequest reqmsg;
struct TagItem tags[10];
char buffer[100] = "Default string";
reqmsg.MethodID = RM_OPENREQ;
reqmsg.or_Attrs = tags;
reqmsg.or_Window = NULL;
reqmsg.or_Screen = myScreenPtr;
tags[0].ti_Tag = REQ_Type;
tags[0].ti_Data = REQTYPE_STRING;
tags[1].ti_Tag = REQ_TitleText;
tags[1].ti_Data = (Tag)"Requesting a string";
tags[2].ti_Tag = REQ_BodyText;
tags[2].ti_Data = (Tag)"Please enter a string";
tags[3].ti_Tag = REQ_GadgetText;
tags[3].ti_Data = (Tag)"_Ok|_Cancel";
tags[4].ti_Tag = REQS_Buffer;
tags[4].ti_Data = (Tag)buffer;
tags[5].ti_Tag = REQS_MaxChars;
tags[5].ti_Data = sizeof(buffer) - 1;
tags[6].ti_Tag = REQS_ShowDefault;
tags[6].ti_Data = TRUE;
tags[7].ti_Tag = REQS_AllowEmpty;
tags[7].ti_Data = FALSE;
tags[8].ti_Tag = REQS_Invisible;
tags[8].ti_Data = FALSE;
tags[9].ti_Tag = TAG_END;
tags[9].ti_Data = 0;
ULONG button_num = DoMethodA(reqobj, (Msg)&reqmsg);
if (button_num == 0)
{
// Cancel button or failed to open.
}
// Buffer contains result string which is the default when
// the user did cancel the requester or it did not open.