fresult YNDialogForm::ShowYNDialog(char* dialogName, char* formTitle, char* formSubtitle, char* msgTitle, char* msgContent, char* yesText) { fresult fres; _TitleText = formTitle; _SubtitleText = formSubtitle; _dialogName = dialogName; uword_t headerLen = Length(msgTitle); fres = _txtHeader->SetText(msgTitle); ENSURESUCCESS(fres); Size sz = _App->GetClientAreaSize(); fres = HCenterTextField(_txtHeader, CenterHorizontaly, headerLen, sz.Width, 0); ENSURESUCCESS(fres); fres = _txtContent->SetText(msgContent); ENSURESUCCESS(fres); TextField* tf = _miYes->GetTextField(); if (tf!=NULL) { fres = tf->SetText(yesText); ENSURESUCCESS(fres); uword_t yesTextLen = Length(yesText); HCenterTextField(tf, ToRight, yesTextLen, sz.Width, 8); } fres = _FormManager->ShowForm(GetName()); ENSURESUCCESS(fres); return SUCCESS; }
fresult xScatteredMenu::CreateTextField( char* str, Size size, Position position, TextFormat* format, TextField** opTextField, Size buffSize) { fresult fres = SUCCESS; TextField* tf = new TextField(); *opTextField = tf; char* buff = new char[buffSize.Height*buffSize.Width]; tf->Init(size, position, buff, buffSize, (IRender*)_renderer); tf->SetWordWrap(FALSE); tf->SetTextFormat(format); fres = tf->SetText(str); if (fres!=SUCCESS) { return fres; } return SUCCESS; }