void PCommandManager::StopMacro() { TRACE(); InputRequest *inputAlert = new InputRequest(_T("Input Macroname"),_T("Name"), _T("Macro"), _T("OK"),_T("Cancel")); char *input = NULL; char *inputstr = NULL; if (recording) { if (inputAlert->Go(&input)<1) { inputstr = new char[strlen(input)+1]; strcpy(inputstr,input); recording->AddString("Name",input); // a littel trick because we need a pointer to the text wich isnt deleted :)) macroList->AddItem(new BMessage(*recording)); BMenuItem *item = new BMenuItem(input,(BMessage *)macroList->LastItem()); item->SetTarget(doc); doc->AddMenuItem(P_MENU_MACRO_PLAY,item); } inputAlert->Lock(); inputAlert->Quit(); delete recording; delete macroIndexer; recording = NULL; macroIndexer = NULL; } }
MyApp(void) : BApplication("application/libwalter-InputRequest") { char reply[256]; InputRequest* ir = new InputRequest("This is the title", "This the label", "Here comes the text", "button label"); ir->Go((char**)&reply); be_app->PostMessage(B_QUIT_REQUESTED); }