UnicodeString MergeHelpKeyword(const UnicodeString & PrimaryHelpKeyword, const UnicodeString & SecondaryHelpKeyword) { if (!PrimaryHelpKeyword.IsEmpty() && !IsInternalErrorHelpKeyword(SecondaryHelpKeyword)) { // we have to yet decide what we have both // PrimaryHelpKeyword and SecondaryHelpKeyword return PrimaryHelpKeyword; } else { return SecondaryHelpKeyword; } }
//--------------------------------------------------------------------------- TForm * __fastcall CreateMessageDialogEx(const UnicodeString Msg, TStrings * MoreMessages, TQueryType Type, unsigned int Answers, UnicodeString HelpKeyword, const TMessageParams * Params, TButton *& TimeoutButton) { TMsgDlgType DlgType; switch (Type) { case qtConfirmation: DlgType = mtConfirmation; break; case qtInformation: DlgType = mtInformation; break; case qtError: DlgType = mtError; break; case qtWarning: DlgType = mtWarning; break; default: FAIL; } unsigned int TimeoutAnswer = (Params != NULL) ? Params->TimeoutAnswer : 0; unsigned int ActualAnswers = Answers; if ((Params == NULL) || Params->AllowHelp) { Answers = Answers | qaHelp; } if (IsInternalErrorHelpKeyword(HelpKeyword)) { Answers = Answers | qaReport; } if ((MoreMessages != NULL) && (MoreMessages->Count == 0)) { MoreMessages = NULL; } UnicodeString ImageName; UnicodeString MoreMessagesUrl; TSize MoreMessagesSize; if (Params != NULL) { ImageName = Params->ImageName; MoreMessagesUrl = Params->MoreMessagesUrl; MoreMessagesSize = Params->MoreMessagesSize; } const TQueryButtonAlias * Aliases = (Params != NULL) ? Params->Aliases : NULL; unsigned int AliasesCount = (Params != NULL) ? Params->AliasesCount : 0; UnicodeString NeverAskAgainCaption; bool HasNeverAskAgain = (Params != NULL) && FLAGSET(Params->Params, mpNeverAskAgainCheck); if (HasNeverAskAgain) { NeverAskAgainCaption = !Params->NeverAskAgainTitle.IsEmpty() ? (UnicodeString)Params->NeverAskAgainTitle : // qaOK | qaIgnore is used, when custom "non-answer" button is required LoadStr(((ActualAnswers == qaOK) || (ActualAnswers == (qaOK | qaIgnore))) ? NEVER_SHOW_AGAIN : NEVER_ASK_AGAIN); } TForm * Dialog = CreateMoreMessageDialog(Msg, MoreMessages, DlgType, Answers, Aliases, AliasesCount, TimeoutAnswer, &TimeoutButton, ImageName, NeverAskAgainCaption, MoreMessagesUrl, MoreMessagesSize); try { if (HasNeverAskAgain && ALWAYS_TRUE(Params != NULL)) { TCheckBox * NeverAskAgainCheck = FindNeverAskAgainCheck(Dialog); NeverAskAgainCheck->Checked = Params->NeverAskAgainCheckedInitially; if (Params->NeverAskAgainAnswer > 0) { NeverAskAgainCheck->Tag = Params->NeverAskAgainAnswer; } TNotifyEvent OnClick; ((TMethod*)&OnClick)->Code = NeverAskAgainCheckClick; NeverAskAgainCheck->OnClick = OnClick; } Dialog->HelpKeyword = HelpKeyword; if (FLAGSET(Answers, qaHelp)) { Dialog->BorderIcons = Dialog->BorderIcons << biHelp; } ResetSystemSettings(Dialog); } catch(...) { delete Dialog; throw; } return Dialog; }