| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260 |
- unit CompMsgBoxDesigner;
- {
- Inno Setup
- Copyright (C) 1997-2020 Jordan Russell
- Portions by Martijn Laan
- For conditions of distribution and use, see LICENSE.TXT.
- MessageBox Designer form
-
- Originally contributed by leserg73
- }
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- UIStateForm, StdCtrls, ExtCtrls, NewStaticText, ComCtrls, pngimage;
- type
- TMsgBoxDesignerForm = class(TUIStateForm)
- IMGmbInformation: TImage;
- IMGmbConfirmation: TImage;
- IMGmbError: TImage;
- IMGmbCriticalError: TImage;
- Panel1: TPanel;
- GroupBox1: TGroupBox;
- GroupBox2: TGroupBox;
- MSGText: TMemo;
- rb_mbInformation: TRadioButton;
- rb_mbConfirmation: TRadioButton;
- rb_mbError: TRadioButton;
- rb_mbCriticalError: TRadioButton;
- GroupBox3: TGroupBox;
- MBDButtonOK: TButton;
- MBDButtonCancel: TButton;
- MBDButtonPreview: TButton;
- Bevel1: TBevel;
- rbMB_OK: TRadioButton;
- rbMB_OKCANCEL: TRadioButton;
- rbMB_YESNO: TRadioButton;
- rbMB_YESNOCANCEL: TRadioButton;
- rbMB_RETRYCANCEL: TRadioButton;
- rbMB_ABORTRETRYIGNORE: TRadioButton;
- GroupBox4: TGroupBox;
- cb_IDOK: TCheckBox;
- cb_IDCANCEL: TCheckBox;
- cb_IDYES: TCheckBox;
- cb_IDNO: TCheckBox;
- cb_IDABORT: TCheckBox;
- cb_IDRETRY: TCheckBox;
- cb_IDIGNORE: TCheckBox;
- GroupBox5: TGroupBox;
- cb_MB_SETFOREGROUND: TCheckBox;
- NewStaticText1: TNewStaticText;
- NewEdit1: TEdit;
- UpDown1: TUpDown;
- GroupBox6: TGroupBox;
- cb_MsgBox: TRadioButton;
- cb_TaskDialogMsgBox: TRadioButton;
- rb_IDOK: TCheckBox;
- rb_IDCANCEL: TCheckBox;
- rb_IDYES: TCheckBox;
- rb_IDNO: TCheckBox;
- rb_IDABORT: TCheckBox;
- rb_IDRETRY: TCheckBox;
- rb_IDIGNORE: TCheckBox;
- TaskInstructionLabel: TNewStaticText;
- TaskMessageLabel: TNewStaticText;
- TaskInstructionText: TEdit;
- TaskMessageText: TEdit;
- Button1Text: TEdit;
- Button2Text: TEdit;
- Button1Label: TNewStaticText;
- Button2Label: TNewStaticText;
- cb_Suppressible: TCheckBox;
- cb_DefIDOK: TRadioButton;
- cb_DefIDCANCEL: TRadioButton;
- cb_DefIDYES: TRadioButton;
- cb_DefIDNO: TRadioButton;
- cb_DefIDABORT: TRadioButton;
- cb_DefIDRETRY: TRadioButton;
- cb_DefIDIGNORE: TRadioButton;
- procedure FormCreate(Sender: TObject);
- procedure UpDown1Changing(Sender: TObject; var AllowChange: Boolean);
- procedure rbMB_OKClick(Sender: TObject);
- procedure rbMB_OKCANCELClick(Sender: TObject);
- procedure rbMB_YESNOClick(Sender: TObject);
- procedure rbMB_RETRYCANCELClick(Sender: TObject);
- procedure rbMB_YESNOCANCELClick(Sender: TObject);
- procedure rbMB_ABORTRETRYIGNOREClick(Sender: TObject);
- procedure MBDButtonPreviewClick(Sender: TObject);
- procedure cb_TaskDialogMsgBoxClick(Sender: TObject);
- procedure cb_MsgBoxClick(Sender: TObject);
- procedure rb_IDOKClick(Sender: TObject);
- procedure rb_IDCANCELClick(Sender: TObject);
- procedure rb_IDNOClick(Sender: TObject);
- procedure rb_IDYESClick(Sender: TObject);
- procedure rb_IDRETRYClick(Sender: TObject);
- procedure rb_IDIGNOREClick(Sender: TObject);
- procedure rb_IDABORTClick(Sender: TObject);
- procedure cb_SuppressibleClick(Sender: TObject);
- procedure MSGTextKeyPress(Sender: TObject; var Key: Char);
- private
- function GetText: String;
- public
- property Text: string read GetText;
- end;
- implementation
- uses
- CmnFunc, CmnFunc2, CompFunc, TaskDialog, Msgs;
- {$R *.DFM}
- procedure TMsgBoxDesignerForm.FormCreate(Sender: TObject);
- begin
- InitFormFont(Self);
- cb_Suppressible.Checked := True;
- MSGText.Lines[MSGText.CaretPos.Y] := '<Enter your text here...>';
- MSGText.SelStart := MSGText.Perform(EM_LINEINDEX, 0, 0);
- MSGText.SelLength := Length(MSGText.Lines[0]);
- cb_IDCANCEL.Enabled := False;
- cb_IDABORT.Enabled := False;
- cb_IDRETRY.Enabled := False;
- cb_IDIGNORE.Enabled := False;
- cb_IDYES.Enabled := False;
- cb_IDNO.Enabled := False;
- NewStaticText1.Enabled := False;
- NewEdit1.Enabled := False;
- UpDown1.Enabled := False;
- TaskInstructionLabel.Visible := False;
- TaskMessageLabel.Visible := False;
- TaskInstructionText.Visible := False;
- TaskMessageText.Visible := False;
- Button1Text.Visible := False;
- Button2Text.Visible := False;
- Button1Label.Visible := False;
- Button2Label.Visible := False;
- end;
- procedure TMsgBoxDesignerForm.rbMB_OKClick(Sender: TObject);
- begin
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- cb_IDOK.Enabled := False;
- cb_IDCANCEL.Enabled := False;
- cb_IDABORT.Enabled := False;
- cb_IDRETRY.Enabled := False;
- cb_IDIGNORE.Enabled := False;
- cb_IDYES.Enabled := False;
- cb_IDNO.Enabled := False;
- NewStaticText1.Enabled := False;
- NewEdit1.Enabled := False;
- NewEdit1.Text := '1';
- UpDown1.Enabled := False;
- if cb_TaskDialogMsgBox.Checked then begin
- rb_IDOK.Enabled := True;
- rb_IDCANCEL.Enabled := False;
- rb_IDABORT.Enabled := False;
- rb_IDRETRY.Enabled := False;
- rb_IDIGNORE.Enabled := False;
- rb_IDYES.Enabled := False;
- rb_IDNO.Enabled := False;
- rb_IDOK.Checked := False;
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- rb_IDIGNORE.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDNO.Checked := False;
- Button2Text.Enabled := False;
- Button2Label.Enabled := False;
- Button1Text.Enabled := True;
- Button1Label.Enabled := True;
- Button1Text.Text := 'OK';
- Button2Text.Text := '';
- end;
- if cb_Suppressible.Checked then begin
- cb_DefIDOK.Checked := True;
- cb_DefIDCANCEL.Checked := False;
- cb_DefIDYES.Checked := False;
- cb_DefIDNO.Checked := False;
- cb_DefIDABORT.Checked := False;
- cb_DefIDRETRY.Checked := False;
- cb_DefIDIGNORE.Checked := False;
- cb_DefIDOK.Enabled := True;
- cb_DefIDCANCEL.Enabled := False;
- cb_DefIDYES.Enabled := False;
- cb_DefIDNO.Enabled := False;
- cb_DefIDABORT.Enabled := False;
- cb_DefIDRETRY.Enabled := False;
- cb_DefIDIGNORE.Enabled := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rbMB_YESNOClick(Sender: TObject);
- begin
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- cb_IDOK.Enabled := False;
- cb_IDCANCEL.Enabled := False;
- cb_IDABORT.Enabled := False;
- cb_IDRETRY.Enabled := False;
- cb_IDIGNORE.Enabled := False;
- cb_IDYES.Enabled := True;
- cb_IDNO.Enabled := True;
- if not cb_TaskDialogMsgBox.Checked then begin
- NewStaticText1.Enabled := True;
- NewEdit1.Enabled := True;
- NewEdit1.Text := '1';
- UpDown1.Max := 2;
- UpDown1.Enabled := True;
- end;
- if cb_TaskDialogMsgBox.Checked then begin
- rb_IDOK.Enabled := False;
- rb_IDCANCEL.Enabled := False;
- rb_IDABORT.Enabled := False;
- rb_IDRETRY.Enabled := False;
- rb_IDIGNORE.Enabled := False;
- rb_IDYES.Enabled := True;
- rb_IDNO.Enabled := True;
- rb_IDOK.Checked := False;
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- rb_IDIGNORE.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDNO.Checked := False;
- Button2Text.Enabled := True;
- Button2Label.Enabled := True;
- Button1Text.Enabled := True;
- Button1Label.Enabled := True;
- Button1Text.Text := 'Yes';
- Button2Text.Text := 'No';
- end;
- if cb_Suppressible.Checked then begin
- cb_DefIDOK.Checked := False;
- cb_DefIDCANCEL.Checked := False;
- cb_DefIDYES.Checked := True;
- cb_DefIDNO.Checked := False;
- cb_DefIDABORT.Checked := False;
- cb_DefIDRETRY.Checked := False;
- cb_DefIDIGNORE.Checked := False;
- cb_DefIDOK.Enabled := False;
- cb_DefIDCANCEL.Enabled := False;
- cb_DefIDYES.Enabled := True;
- cb_DefIDNO.Enabled := True;
- cb_DefIDABORT.Enabled := False;
- cb_DefIDRETRY.Enabled := False;
- cb_DefIDIGNORE.Enabled := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rbMB_OKCANCELClick(Sender: TObject);
- begin
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- cb_IDOK.Enabled := True;
- cb_IDCANCEL.Enabled := True;
- cb_IDABORT.Enabled := False;
- cb_IDRETRY.Enabled := False;
- cb_IDIGNORE.Enabled := False;
- cb_IDYES.Enabled := False;
- cb_IDNO.Enabled := False;
- if not cb_TaskDialogMsgBox.Checked then begin
- NewStaticText1.Enabled := True;
- NewEdit1.Enabled := True;
- NewEdit1.Text := '1';
- UpDown1.Max := 2;
- UpDown1.Enabled := True;
- end;
- if cb_TaskDialogMsgBox.Checked then begin
- rb_IDOK.Enabled := True;
- rb_IDCANCEL.Enabled := True;
- rb_IDABORT.Enabled := False;
- rb_IDRETRY.Enabled := False;
- rb_IDIGNORE.Enabled := False;
- rb_IDYES.Enabled := False;
- rb_IDNO.Enabled := False;
- rb_IDOK.Checked := False;
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- rb_IDIGNORE.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDNO.Checked := False;
- Button2Text.Enabled := False;
- Button2Label.Enabled := False;
- Button1Text.Enabled := True;
- Button1Label.Enabled := True;
- Button1Text.Text := 'OK';
- Button2Text.Text := '';
- end;
- if cb_Suppressible.Checked then begin
- cb_DefIDOK.Checked := True;
- cb_DefIDCANCEL.Checked := False;
- cb_DefIDYES.Checked := False;
- cb_DefIDNO.Checked := False;
- cb_DefIDABORT.Checked := False;
- cb_DefIDRETRY.Checked := False;
- cb_DefIDIGNORE.Checked := False;
- cb_DefIDOK.Enabled := True;
- cb_DefIDCANCEL.Enabled := True;
- cb_DefIDYES.Enabled := False;
- cb_DefIDNO.Enabled := False;
- cb_DefIDABORT.Enabled := False;
- cb_DefIDRETRY.Enabled := False;
- cb_DefIDIGNORE.Enabled := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rbMB_RETRYCANCELClick(Sender: TObject);
- begin
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- cb_IDOK.Enabled := False;
- cb_IDCANCEL.Enabled := True;
- cb_IDABORT.Enabled := False;
- cb_IDRETRY.Enabled := True;
- cb_IDIGNORE.Enabled := False;
- cb_IDYES.Enabled := False;
- cb_IDNO.Enabled := False;
- if not cb_TaskDialogMsgBox.Checked then begin
- NewStaticText1.Enabled := True;
- NewEdit1.Enabled := True;
- NewEdit1.Text := '1';
- UpDown1.Max := 2;
- UpDown1.Enabled := True;
- end;
- if cb_TaskDialogMsgBox.Checked then begin
- rb_IDOK.Enabled := False;
- rb_IDCANCEL.Enabled := True;
- rb_IDABORT.Enabled := False;
- rb_IDRETRY.Enabled := True;
- rb_IDIGNORE.Enabled := False;
- rb_IDYES.Enabled := False;
- rb_IDNO.Enabled := False;
- rb_IDOK.Checked := False;
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- rb_IDIGNORE.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDNO.Checked := False;
- Button2Text.Enabled := False;
- Button2Label.Enabled := False;
- Button1Text.Enabled := True;
- Button1Label.Enabled := True;
- Button1Text.Text := 'Retry';
- Button2Text.Text := '';
- end;
- if cb_Suppressible.Checked then begin
- cb_DefIDOK.Checked := False;
- cb_DefIDCANCEL.Checked := True;
- cb_DefIDYES.Checked := False;
- cb_DefIDNO.Checked := False;
- cb_DefIDABORT.Checked := False;
- cb_DefIDRETRY.Checked := False;
- cb_DefIDIGNORE.Checked := False;
- cb_DefIDOK.Enabled := False;
- cb_DefIDCANCEL.Enabled := True;
- cb_DefIDYES.Enabled := False;
- cb_DefIDNO.Enabled := False;
- cb_DefIDABORT.Enabled := False;
- cb_DefIDRETRY.Enabled := True;
- cb_DefIDIGNORE.Enabled := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rbMB_YESNOCANCELClick(Sender: TObject);
- begin
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- cb_IDOK.Enabled := False;
- cb_IDCANCEL.Enabled := True;
- cb_IDABORT.Enabled := False;
- cb_IDRETRY.Enabled := False;
- cb_IDIGNORE.Enabled := False;
- cb_IDYES.Enabled := True;
- cb_IDNO.Enabled := True;
- if not cb_TaskDialogMsgBox.Checked then begin
- NewStaticText1.Enabled := True;
- NewEdit1.Enabled := True;
- NewEdit1.Text := '1';
- UpDown1.Max := 3;
- UpDown1.Enabled := True;
- end;
- if cb_TaskDialogMsgBox.Checked then begin
- rb_IDOK.Enabled := False;
- rb_IDCANCEL.Enabled := True;
- rb_IDABORT.Enabled := False;
- rb_IDRETRY.Enabled := False;
- rb_IDIGNORE.Enabled := False;
- rb_IDYES.Enabled := True;
- rb_IDNO.Enabled := True;
- rb_IDOK.Checked := False;
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- rb_IDIGNORE.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDNO.Checked := False;
- Button2Text.Enabled := True;
- Button2Label.Enabled := True;
- Button1Text.Enabled := True;
- Button1Label.Enabled := True;
- Button1Text.Text := 'Yes';
- Button2Text.Text := 'No';
- end;
- if cb_Suppressible.Checked then begin
- cb_DefIDOK.Checked := False;
- cb_DefIDCANCEL.Checked := False;
- cb_DefIDYES.Checked := True;
- cb_DefIDNO.Checked := False;
- cb_DefIDABORT.Checked := False;
- cb_DefIDRETRY.Checked := False;
- cb_DefIDIGNORE.Checked := False;
- cb_DefIDOK.Enabled := False;
- cb_DefIDCANCEL.Enabled := True;
- cb_DefIDYES.Enabled := True;
- cb_DefIDNO.Enabled := True;
- cb_DefIDABORT.Enabled := False;
- cb_DefIDRETRY.Enabled := False;
- cb_DefIDIGNORE.Enabled := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rbMB_ABORTRETRYIGNOREClick(Sender: TObject);
- begin
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- cb_IDOK.Enabled := False;
- cb_IDCANCEL.Enabled := False;
- cb_IDABORT.Enabled := True;
- cb_IDRETRY.Enabled := True;
- cb_IDIGNORE.Enabled := True;
- cb_IDYES.Enabled := False;
- cb_IDNO.Enabled := False;
- if not cb_TaskDialogMsgBox.Checked then begin
- NewStaticText1.Enabled := True;
- NewEdit1.Enabled := True;
- NewEdit1.Text := '1';
- UpDown1.Max := 3;
- UpDown1.Enabled := True;
- end;
- if cb_TaskDialogMsgBox.Checked then begin
- rb_IDOK.Enabled := False;
- rb_IDCANCEL.Enabled := False;
- rb_IDABORT.Enabled := True;
- rb_IDRETRY.Enabled := True;
- rb_IDIGNORE.Enabled := True;
- rb_IDYES.Enabled := False;
- rb_IDNO.Enabled := False;
- rb_IDOK.Checked := False;
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- rb_IDIGNORE.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDNO.Checked := False;
- Button2Text.Enabled := False;
- Button2Label.Enabled := False;
- Button1Text.Enabled := False;
- Button1Label.Enabled := False;
- Button1Text.Text := '';
- Button2Text.Text := '';
- end;
- if cb_Suppressible.Checked then begin
- cb_DefIDOK.Checked := False;
- cb_DefIDCANCEL.Checked := False;
- cb_DefIDYES.Checked := False;
- cb_DefIDNO.Checked := False;
- cb_DefIDABORT.Checked := False;
- cb_DefIDRETRY.Checked := False;
- cb_DefIDIGNORE.Checked := True;
- cb_DefIDOK.Enabled := False;
- cb_DefIDCANCEL.Enabled := False;
- cb_DefIDYES.Enabled := False;
- cb_DefIDNO.Enabled := False;
- cb_DefIDABORT.Enabled := True;
- cb_DefIDRETRY.Enabled := True;
- cb_DefIDIGNORE.Enabled := True;
- end;
- end;
- procedure TMsgBoxDesignerForm.UpDown1Changing(Sender: TObject; var AllowChange: Boolean);
- begin
- AllowChange := True;
- end;
- procedure TMsgBoxDesignerForm.cb_MsgBoxClick(Sender: TObject);
- begin
- IMGmbConfirmation.Visible := True;
- cb_MB_SETFOREGROUND.Enabled := True;
- cb_MB_SETFOREGROUND.Checked := False;
- GroupBox1.Visible := True;
- if not cb_Suppressible.Checked then begin
- GroupBox4.Caption := ' Return values ';
- cb_DefIDOK.Visible := False;
- cb_DefIDCANCEL.Visible := False;
- cb_DefIDYES.Visible := False;
- cb_DefIDNO.Visible := False;
- cb_DefIDABORT.Visible := False;
- cb_DefIDRETRY.Visible := False;
- cb_DefIDIGNORE.Visible := False;
- end
- else begin
- GroupBox4.Caption := ' Return values / -------- / Default ';
- cb_DefIDOK.Visible := True;
- cb_DefIDCANCEL.Visible := True;
- cb_DefIDYES.Visible := True;
- cb_DefIDNO.Visible := True;
- cb_DefIDABORT.Visible := True;
- cb_DefIDRETRY.Visible := True;
- cb_DefIDIGNORE.Visible := True;
- end;
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- rb_IDOK.Visible := False;
- rb_IDCANCEL.Visible := False;
- rb_IDABORT.Visible := False;
- rb_IDRETRY.Visible := False;
- rb_IDIGNORE.Visible := False;
- rb_IDYES.Visible := False;
- rb_IDNO.Visible := False;
- rb_mbInformation.Checked := True;
- TaskInstructionLabel.Visible := False;
- TaskMessageLabel.Visible := False;
- TaskInstructionText.Visible := False;
- TaskMessageText.Visible := False;
- Button1Text.Visible := False;
- Button2Text.Visible := False;
- Button1Label.Visible := False;
- Button2Label.Visible := False;
- rbMB_OK.Checked := True;
- rbMB_OKClick(Self);
- end;
- procedure TMsgBoxDesignerForm.cb_SuppressibleClick(Sender: TObject);
- begin
- if cb_Suppressible.Checked then begin
- cb_DefIDOK.Visible := True;
- cb_DefIDCANCEL.Visible := True;
- cb_DefIDYES.Visible := True;
- cb_DefIDNO.Visible := True;
- cb_DefIDABORT.Visible := True;
- cb_DefIDRETRY.Visible := True;
- cb_DefIDIGNORE.Visible := True;
- if cb_MsgBox.Checked then
- GroupBox4.Caption := ' Return values / -------- / Default ';
- if cb_TaskDialogMsgBox.Checked then
- GroupBox4.Caption := ' Return values / Shield / Default ';
- end
- else begin
- cb_DefIDOK.Checked := False;
- cb_DefIDCANCEL.Checked := False;
- cb_DefIDYES.Checked := False;
- cb_DefIDNO.Checked := False;
- cb_DefIDABORT.Checked := False;
- cb_DefIDRETRY.Checked := False;
- cb_DefIDIGNORE.Checked := False;
- cb_DefIDOK.Visible := False;
- cb_DefIDCANCEL.Visible := False;
- cb_DefIDYES.Visible := False;
- cb_DefIDNO.Visible := False;
- cb_DefIDABORT.Visible := False;
- cb_DefIDRETRY.Visible := False;
- cb_DefIDIGNORE.Visible := False;
- if cb_MsgBox.Checked then
- GroupBox4.Caption := ' Return values ';
- if cb_TaskDialogMsgBox.Checked then
- GroupBox4.Caption := ' Return values / Shield ';
- end;
- if rbMB_OK.Checked then rbMB_OKClick(Self);
- if rbMB_OKCANCEL.Checked then rbMB_OKCANCELClick(Self);
- if rbMB_YESNO.Checked then rbMB_YESNOClick(Self);
- if rbMB_YESNOCANCEL.Checked then rbMB_YESNOCANCELClick(Self);
- if rbMB_RETRYCANCEL.Checked then rbMB_RETRYCANCELClick(Self);
- if rbMB_ABORTRETRYIGNORE.Checked then rbMB_ABORTRETRYIGNOREClick(Self);
- end;
- procedure TMsgBoxDesignerForm.cb_TaskDialogMsgBoxClick(Sender: TObject);
- begin
- IMGmbConfirmation.Visible := False;
- cb_MB_SETFOREGROUND.Enabled := False;
- cb_MB_SETFOREGROUND.Checked := False;
- GroupBox1.Visible := False;
- if not cb_Suppressible.Checked then begin
- GroupBox4.Caption := ' Return values / Shield ';
- cb_DefIDOK.Visible := False;
- cb_DefIDCANCEL.Visible := False;
- cb_DefIDYES.Visible := False;
- cb_DefIDNO.Visible := False;
- cb_DefIDABORT.Visible := False;
- cb_DefIDRETRY.Visible := False;
- cb_DefIDIGNORE.Visible := False;
- end
- else begin
- GroupBox4.Caption := ' Return values / Shield / Default ';
- cb_DefIDOK.Visible := True;
- cb_DefIDCANCEL.Visible := True;
- cb_DefIDYES.Visible := True;
- cb_DefIDNO.Visible := True;
- cb_DefIDABORT.Visible := True;
- cb_DefIDRETRY.Visible := True;
- cb_DefIDIGNORE.Visible := True;
- end;
- cb_IDOK.Checked := False;
- cb_IDCANCEL.Checked := False;
- cb_IDABORT.Checked := False;
- cb_IDRETRY.Checked := False;
- cb_IDIGNORE.Checked := False;
- cb_IDYES.Checked := False;
- cb_IDNO.Checked := False;
- rb_IDOK.Checked := False;
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- rb_IDIGNORE.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDNO.Checked := False;
- rb_IDOK.Visible := True;
- rb_IDCANCEL.Visible := True;
- rb_IDABORT.Visible := True;
- rb_IDRETRY.Visible := True;
- rb_IDIGNORE.Visible := True;
- rb_IDYES.Visible := True;
- rb_IDNO.Visible := True;
- rb_mbInformation.Checked := True;
- TaskInstructionLabel.Visible := True;
- TaskMessageLabel.Visible := True;
- TaskInstructionText.Visible := True;
- TaskMessageText.Visible := True;
- Button1Text.Visible := True;
- Button2Text.Visible := True;
- Button1Label.Visible := True;
- Button2Label.Visible := True;
- TaskInstructionText.Text := 'Instruction Text';
- TaskMessageText.Text := 'Message Text';
- // Button1Text.Text := '';
- // Button2Text.Text := '';
- rbMB_OK.Checked := True;
- rbMB_OKClick(Self);
- end;
- procedure TMsgBoxDesignerForm.rb_IDOKClick(Sender: TObject);
- begin
- if rb_IDOK.Checked then
- rb_IDCANCEL.Checked := False;
- end;
- procedure TMsgBoxDesignerForm.rb_IDCANCELClick(Sender: TObject);
- begin
- if rb_IDCANCEL.Checked then begin
- rb_IDOK.Checked := False;
- rb_IDNO.Checked := False;
- rb_IDYES.Checked := False;
- rb_IDRETRY.Checked := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rb_IDYESClick(Sender: TObject);
- begin
- if rb_IDYES.Checked then begin
- rb_IDNO.Checked := False;
- rb_IDCANCEL.Checked := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rb_IDNOClick(Sender: TObject);
- begin
- if rb_IDNO.Checked then begin
- rb_IDYES.Checked := False;
- rb_IDCANCEL.Checked := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rb_IDRETRYClick(Sender: TObject);
- begin
- if rb_IDRETRY.Checked then begin
- rb_IDCANCEL.Checked := False;
- rb_IDABORT.Checked := False;
- rb_IDIGNORE.Checked := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rb_IDIGNOREClick(Sender: TObject);
- begin
- if rb_IDIGNORE.Checked then begin
- rb_IDABORT.Checked := False;
- rb_IDRETRY.Checked := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.rb_IDABORTClick(Sender: TObject);
- begin
- if rb_IDABORT.Checked then begin
- rb_IDIGNORE.Checked := False;
- rb_IDRETRY.Checked := False;
- end;
- end;
- procedure TMsgBoxDesignerForm.MBDButtonPreviewClick(Sender: TObject);
- var
- ButtonsBtn : Cardinal;
- TypeIcon : TMsgBoxType;
- CaptionMsg : String;
- ShieldFlag : Integer;
- ButtonLabelsArray: TArray<string>;
- begin
- { default value }
- ButtonsBtn := MB_OK;
- TypeIcon := mbInformation;
- ShieldFlag := 0;
- { icon and caption set }
- if rb_mbInformation.Checked then begin
- CaptionMsg := 'Info';
- TypeIcon := mbInformation;
- end;
- if rb_mbConfirmation.Checked then begin
- CaptionMsg := 'Confirm';
- TypeIcon := mbConfirmation;
- end;
- if rb_mbError.Checked then begin
- CaptionMsg := 'Error';
- TypeIcon := mbError;
- end;
- if rb_mbCriticalError.Checked then begin
- CaptionMsg := 'Fatal Error';
- TypeIcon := mbCriticalError;
- end;
- { button type set }
- if rbMB_OK.Checked then ButtonsBtn := MB_OK;
- if rbMB_OKCANCEL.Checked then ButtonsBtn := MB_OKCANCEL;
- if rbMB_YESNO.Checked then ButtonsBtn := MB_YESNO;
- if rbMB_YESNOCANCEL.Checked then ButtonsBtn := MB_YESNOCANCEL;
- if rbMB_RETRYCANCEL.Checked then ButtonsBtn := MB_RETRYCANCEL;
- if rbMB_ABORTRETRYIGNORE.Checked then ButtonsBtn := MB_ABORTRETRYIGNORE;
- { MsgBox(Text, Caption, Typ, Buttons); preview }
- if cb_MsgBox.Checked then begin
- if MSGText.GetTextLen = 0 then
- MSGText.Lines.Add('Your message text.');
- { MessageBox with DefButton }
- if NewEdit1.Text = '1' then
- MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn);
- if NewEdit1.Text = '2' then
- MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON2);
- if NewEdit1.Text = '3' then
- MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON3);
- { MessageBox with DefButton and Flag MB_SETFOREGROUND }
- if (NewEdit1.Text = '1') and (cb_MB_SETFOREGROUND.Checked) then
- MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_SETFOREGROUND);
- if (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
- MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON2 or MB_SETFOREGROUND);
- if (NewEdit1.Text = '3') and (cb_MB_SETFOREGROUND.Checked) then
- MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON3 or MB_SETFOREGROUND);
- end;
- { TaskDialogMsgBox preview}
- if cb_TaskDialogMsgBox.Checked then begin
- { create ButtonLabels array }
- if rbMB_YESNO.Checked or rbMB_YESNOCANCEL.Checked then
- ButtonLabelsArray := TArray<string>.Create(Button1Text.Text, Button2Text.Text)
- else if rbMB_ABORTRETRYIGNORE.Checked then
- ButtonLabelsArray := TArray<string>.Create('Retry', 'Ignore', 'Abort')
- else
- ButtonLabelsArray := TArray<string>.Create(Button1Text.Text);
- { get Shield Flag value }
- if rbMB_OK.Checked and rb_IDOK.Checked then ShieldFlag := IDOK;
- if rbMB_OKCANCEL.Checked and rb_IDOK.Checked then ShieldFlag := IDOK;
- if rbMB_OKCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlag := IDCANCEL;
- if rbMB_YESNO.Checked and rb_IDYES.Checked then ShieldFlag := IDYES;
- if rbMB_YESNO.Checked and rb_IDNO.Checked then ShieldFlag := IDNO;
- if rbMB_YESNOCANCEL.Checked and rb_IDYES.Checked then ShieldFlag := IDYES;
- if rbMB_YESNOCANCEL.Checked and rb_IDNO.Checked then ShieldFlag := IDNO;
- if rbMB_YESNOCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlag := IDCANCEL;
- if rbMB_RETRYCANCEL.Checked and rb_IDRETRY.Checked then ShieldFlag := IDRETRY;
- if rbMB_RETRYCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlag := IDCANCEL;
- if rbMB_ABORTRETRYIGNORE.Checked and rb_IDRETRY.Checked then ShieldFlag := IDRETRY;
- if rbMB_ABORTRETRYIGNORE.Checked and rb_IDABORT.Checked then ShieldFlag := IDABORT;
- if rbMB_ABORTRETRYIGNORE.Checked and rb_IDIGNORE.Checked then ShieldFlag := IDIGNORE;
- { TaskDialogMsgBox(Icon, Instruction, Text, Caption, Typ, Buttons, ButtonLabels, ShieldButton) }
- TaskDialogMsgBox('',
- TaskInstructionText.Text,
- TaskMessageText.Text,
- CaptionMsg,
- TypeIcon,
- ButtonsBtn,
- ButtonLabelsArray,
- ShieldFlag);
- end;
- end;
- procedure TMsgBoxDesignerForm.MSGTextKeyPress(Sender: TObject; var Key: Char);
- begin
- if Key = #27 then begin
- MBDButtonCancel.Click;
- Key := #0;
- end;
- end;
- function TMsgBoxDesignerForm.GetText: String;
- { MsgBox / SuppressibleMsgBox }
- function TextMsg(M: Integer; a, b, c, d, e, f: String): String;
- { (M) - TypeMsg
- (a) - TextMsgIf
- (b) - IconTypes
- (c) - ButtonBtn
- (d) - IDButton
- (e) - IDButton2
- (f) - IDButton3 }
- var
- SMsg, TypeMsgBox : String;
- begin
- if not cb_Suppressible.Checked then
- TypeMsgBox := 'MsgBox'
- else
- TypeMsgBox := 'SuppressibleMsgBox';
- SMsg := TypeMsgBox + '(''' + a + ''', ' + b + ', ' + c + ')';
- case M of
- 0: Result := SMsg + ';';
- 1: Result := 'if ' + SMsg + ' = ' + d + ' then' + SNewLine + 'begin' + SNewLine + #9 + '// user clicked ' + StringReplace(d, 'ID', '', []) + SNewLine + 'end;';
- 2: Result := 'case ' + SMsg + ' of ' + SNewLine + #9 + d +': { user clicked ' + StringReplace(d, 'ID', '', []) + ' };' + SNewLine + #9 + e +': { user clicked ' + StringReplace(e, 'ID', '', []) + ' };' + SNewLine + 'end;';
- 3: Result := 'case ' + SMsg + ' of ' + SNewLine + #9 + d +': { user clicked ' + StringReplace(d, 'ID', '', []) + ' };' + SNewLine + #9 + e +': { user clicked ' + StringReplace(e, 'ID', '', []) + ' };' + SNewLine + #9 + 'else { user clicked ' + StringReplace(f, 'ID', '', []) + ' };' + SNewLine + 'end;';
- end;
- end;
- { TaskDialogMsgBox / SuppressibleTaskDialogMsgBox }
- function TextTask(N: Integer; a, b, c, r, s, d, e, f: String): String;
- { (N) - TypeMsg
- (a) - TextMsgIf (Button1Text.Text and Button2Text.Text)
- (b) - IconTypes
- (c) - ButtonBtn
- (r) - BtnTextArr
- (s) - ShieldFlg
- (d) - IDButton
- (e) - IDButton2
- (f) - IDButton3 }
- var
- STsg, TypeMsgBox : String;
- begin
- if not cb_Suppressible.Checked then
- TypeMsgBox := 'TaskDialogMsgBox'
- else
- TypeMsgBox := 'SuppressibleTaskDialogMsgBox';
- STsg := TypeMsgBox + '(''' + a + ''', ' + b + ', ' + c + ', [''' + r + '''], ' + s + ')';
- case N of
- 0: Result := STsg + ';';
- 1: Result := 'if ' + STsg + ' = ' + d + ' then' + SNewLine + 'begin' + SNewLine + #9 + '// user clicked ' + StringReplace(d, 'ID', '', []) + SNewLine + 'end;';
- 2: Result := 'case ' + STsg + ' of ' + SNewLine + #9 + d +': { user clicked ' + StringReplace(d, 'ID', '', []) + ' };' + SNewLine + #9 + e +': { user clicked ' + StringReplace(e, 'ID', '', []) + ' };' + SNewLine + 'end;';
- 3: Result := 'case ' + STsg + ' of ' + SNewLine + #9 + d +': { user clicked ' + StringReplace(d, 'ID', '', []) + ' };' + SNewLine + #9 + e +': { user clicked ' + StringReplace(e, 'ID', '', []) + ' };' + SNewLine + #9 + 'else { user clicked ' + StringReplace(f, 'ID', '', []) + ' };' + SNewLine + 'end;';
- end;
- end;
- const
- remarka = '// Display a message box';
- var
- MSGTextInsert: TStringList;
- ButtonBtn, TextMsgIf, IconTypes : String;
- IDButton, IDButton2, IDButton3 : String;
- TypeMsg, ModeMsg : Integer;
- BtnTextArr, ShieldFlg, BtnSupprDef : String;
- begin
- { default value }
- ButtonBtn := 'MB_OK';
- IconTypes := 'mbInformation';
- ShieldFlg := '0';
- TypeMsg := 0;
- ModeMsg := 0;
- BtnSupprDef := '';
- { make a string with DefBtn for Suppressible }
- if cb_Suppressible.Checked then begin
- if cb_DefIDOK.Checked then BtnSupprDef := ', IDOK';
- if cb_DefIDCANCEL.Checked then BtnSupprDef := ', IDCANCEL';
- if cb_DefIDYES.Checked then BtnSupprDef := ', IDYES';
- if cb_DefIDNO.Checked then BtnSupprDef := ', IDNO';
- if cb_DefIDABORT.Checked then BtnSupprDef := ', IDABORT';
- if cb_DefIDRETRY.Checked then BtnSupprDef := ', IDRETRY';
- if cb_DefIDIGNORE.Checked then BtnSupprDef := ', IDIGNORE';
- end;
- { icon and caption set }
- if rb_mbInformation.Checked then begin
- IconTypes := 'mbInformation';
- end;
- if rb_mbConfirmation.Checked then begin
- IconTypes := 'mbConfirmation';
- end;
- if rb_mbError.Checked then begin
- IconTypes := 'mbError';
- end;
- if rb_mbCriticalError.Checked then begin
- IconTypes := 'mbCriticalError';
- end;
- { button type set }
- if rbMB_OK.Checked then ButtonBtn := 'MB_OK';
- if rbMB_OKCANCEL.Checked then ButtonBtn := 'MB_OKCANCEL';
- if rbMB_YESNO.Checked then ButtonBtn := 'MB_YESNO';
- if rbMB_YESNOCANCEL.Checked then ButtonBtn := 'MB_YESNOCANCEL';
- if rbMB_RETRYCANCEL.Checked then ButtonBtn := 'MB_RETRYCANCEL';
- if rbMB_ABORTRETRYIGNORE.Checked then ButtonBtn := 'MB_ABORTRETRYIGNORE';
- MSGTextInsert := TStringList.Create;
- try
- MSGTextInsert.Add(remarka);
- if cb_MsgBox.Checked then begin
- { MsgBox(Text, Typ, Buttons); }
- ModeMsg := 0;
- // rbMB_OK.Checked
- { MessageBox with DefButton }
- { MessageBox with DefButton and Flag MB_SETFOREGROUND }
- if (rbMB_OK.Checked) and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_OK or MB_SETFOREGROUND';
- // rbMB_OKCANCEL
- { MessageBox with DefButton }
- if (rbMB_OKCANCEL.Checked) and (NewEdit1.Text = '2') then
- ButtonBtn := 'MB_OKCANCEL or MB_DEFBUTTON2';
- { MessageBox with DefButton and Flag MB_SETFOREGROUND }
- if (rbMB_OKCANCEL.Checked) and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_OKCANCEL or MB_SETFOREGROUND';
- if (rbMB_OKCANCEL.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_OKCANCEL or MB_DEFBUTTON2 or MB_SETFOREGROUND';
- // rbMB_YESNO
- { MessageBox with DefButton }
- if (rbMB_YESNO.Checked) and (NewEdit1.Text = '2') then
- ButtonBtn := 'MB_YESNO or MB_DEFBUTTON2';
- { MessageBox with DefButton and Flag MB_SETFOREGROUND }
- if (rbMB_YESNO.Checked) and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_YESNO or MB_SETFOREGROUND';
- if (rbMB_YESNO.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_YESNO or MB_DEFBUTTON2 or MB_SETFOREGROUND';
- // rbMB_RETRYCANCEL
- { MessageBox with DefButton }
- if (rbMB_RETRYCANCEL.Checked) and (NewEdit1.Text = '2') then
- ButtonBtn := 'MB_RETRYCANCEL or MB_DEFBUTTON2';
- { MessageBox with DefButton and Flag MB_SETFOREGROUND }
- if (rbMB_RETRYCANCEL.Checked) and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_RETRYCANCEL or MB_SETFOREGROUND';
- if (rbMB_RETRYCANCEL.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_RETRYCANCEL or MB_DEFBUTTON2 or MB_SETFOREGROUND';
- // rbMB_YESNOCANCEL
- { MessageBox with DefButton }
- if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '2') then
- ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON2';
- if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '3') then
- ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON3';
- { MessageBox with DefButton and Flag MB_SETFOREGROUND }
- if (rbMB_YESNOCANCEL.Checked) and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_YESNOCANCEL or MB_SETFOREGROUND';
- if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON2 or MB_SETFOREGROUND';
- if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '3') and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON3 or MB_SETFOREGROUND';
- // rbMB_ABORTRETRYIGNORE
- { MessageBox with DefButton }
- if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '2') then
- ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON2';
- if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '3') then
- ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON3';
- { MessageBox with DefButton and Flag MB_SETFOREGROUND }
- if (rbMB_ABORTRETRYIGNORE.Checked) and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_SETFOREGROUND';
- if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON2 or MB_SETFOREGROUND';
- if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '3') and (cb_MB_SETFOREGROUND.Checked) then
- ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON3 or MB_SETFOREGROUND';
- { Suppressible msg }
- if cb_Suppressible.Checked then ButtonBtn := ButtonBtn + BtnSupprDef;
- { replace in a message string escape /r/n }
- TextMsgIf := StringReplace(MSGText.Lines.GetText, SNewLine, '''#13#10''', [rfReplaceAll]);
- end;
- if cb_TaskDialogMsgBox.Checked then begin
- { TaskDialogMsgBox(TaskInstructionText.Text, TaskMessageText.Text, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg) }
- ModeMsg := 1;
- { create ButtonLabels array }
- if rbMB_YESNO.Checked or rbMB_YESNOCANCEL.Checked then
- BtnTextArr := Button1Text.Text + ''', ''' + Button2Text.Text
- else if rbMB_ABORTRETRYIGNORE.Checked then
- BtnTextArr := 'Retry'', ''Ignore'', ''Abort'
- else
- BtnTextArr := Button1Text.Text;
- { get Shield Flag value }
- if rbMB_OK.Checked and rb_IDOK.Checked then ShieldFlg := 'IDOK';
- if rbMB_OKCANCEL.Checked and rb_IDOK.Checked then ShieldFlg := 'IDOK';
- if rbMB_OKCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlg := 'IDCANCEL';
- if rbMB_YESNO.Checked and rb_IDYES.Checked then ShieldFlg := 'IDYES';
- if rbMB_YESNO.Checked and rb_IDNO.Checked then ShieldFlg := 'IDNO';
- if rbMB_YESNOCANCEL.Checked and rb_IDYES.Checked then ShieldFlg := 'IDYES';
- if rbMB_YESNOCANCEL.Checked and rb_IDNO.Checked then ShieldFlg := 'IDNO';
- if rbMB_YESNOCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlg := 'IDCANCEL';
- if rbMB_RETRYCANCEL.Checked and rb_IDRETRY.Checked then ShieldFlg := 'IDRETRY';
- if rbMB_RETRYCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlg := 'IDCANCEL';
- if rbMB_ABORTRETRYIGNORE.Checked and rb_IDRETRY.Checked then ShieldFlg := 'IDRETRY';
- if rbMB_ABORTRETRYIGNORE.Checked and rb_IDABORT.Checked then ShieldFlg := 'IDABORT';
- if rbMB_ABORTRETRYIGNORE.Checked and rb_IDIGNORE.Checked then ShieldFlg := 'IDIGNORE';
- { Suppressible msg }
- if cb_Suppressible.Checked then ShieldFlg := ShieldFlg + BtnSupprDef;
- TextMsgIf := TaskInstructionText.Text + ''', ''' + TaskMessageText.Text;
- end;
- { selected button OK }
- if (cb_IDOK.Checked and not cb_IDCANCEL.Checked) then begin
- IDButton := 'IDOK';
- TypeMsg := 1;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
- end;
- end
- { selected button CANCEL }
- else if (cb_IDCANCEL.Checked and not cb_IDOK.Checked and not cb_IDRETRY.Checked and not cb_IDYES.Checked and not cb_IDNO.Checked and not cb_IDABORT.Checked and not cb_IDIGNORE.Checked) then begin
- IDButton := 'IDCANCEL';
- TypeMsg := 1;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
- end;
- end
- { selected button OK and CANCEL }
- else if (cb_IDCANCEL.Checked and cb_IDOK.Checked and not cb_IDRETRY.Checked and not cb_IDYES.Checked and not cb_IDNO.Checked) then begin
- IDButton := 'IDOK';
- IDButton2 := 'IDCANCEL';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button YES }
- else if (cb_IDYES.Checked and not cb_IDNO.Checked and not cb_IDCANCEL.Checked) then begin
- IDButton := 'IDYES';
- TypeMsg := 1;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
- end;
- end
- { selected button NO }
- else if (cb_IDNO.Checked and not cb_IDYES.Checked and not cb_IDCANCEL.Checked) then begin
- IDButton := 'IDNO';
- TypeMsg := 1;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
- end;
- end
- { selected button YES and NO }
- else if (cb_IDYES.Checked and cb_IDNO.Checked and not cb_IDCANCEL.Checked) then begin
- IDButton := 'IDYES';
- IDButton2 := 'IDNO';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button YES and CANCEL }
- else if (cb_IDYES.Checked and not cb_IDNO.Checked and cb_IDCANCEL.Checked) then begin
- IDButton := 'IDYES';
- IDButton2 := 'IDCANCEL';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button NO and CANCEL }
- else if (cb_IDNO.Checked and not cb_IDYES.Checked and cb_IDCANCEL.Checked) then begin
- IDButton := 'IDNO';
- IDButton2 := 'IDCANCEL';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button YES, NO and CANCEL }
- else if (cb_IDYES.Checked and cb_IDNO.Checked and cb_IDCANCEL.Checked) then begin
- IDButton := 'IDYES';
- IDButton2 := 'IDNO';
- IDButton3 := 'IDCANCEL';
- TypeMsg := 3;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, IDButton3);
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, IDButton3);
- end;
- end
- { selected button RETRY }
- else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and not cb_IDABORT.Checked and not cb_IDIGNORE.Checked) then begin
- IDButton := 'IDRETRY';
- TypeMsg := 1;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
- end;
- end
- { selected button RETRY and CANCEL }
- else if (cb_IDRETRY.Checked and cb_IDCANCEL.Checked and not cb_IDABORT.Checked and not cb_IDIGNORE.Checked) then begin
- IDButton := 'IDRETRY';
- IDButton2 := 'IDCANCEL';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button IGNORE }
- else if (cb_IDIGNORE.Checked and not cb_IDCANCEL.Checked and not cb_IDABORT.Checked and not cb_IDRETRY.Checked) then begin
- IDButton := 'IDIGNORE';
- TypeMsg := 1;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
- end;
- end
- { selected button ABORT }
- else if (cb_IDABORT.Checked and not cb_IDCANCEL.Checked and not cb_IDRETRY.Checked and not cb_IDIGNORE.Checked) then begin
- IDButton := 'IDABORT';
- TypeMsg := 1;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
- end;
- end
- { selected button RETRY and IGNORE }
- else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and not cb_IDABORT.Checked and cb_IDIGNORE.Checked) then begin
- IDButton := 'IDRETRY';
- IDButton2 := 'IDIGNORE';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button RETRY and ABORT }
- else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and cb_IDABORT.Checked and not cb_IDIGNORE.Checked) then begin
- IDButton := 'IDRETRY';
- IDButton2 := 'IDABORT';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button IGNORE and ABORT }
- else if (not cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and cb_IDABORT.Checked and cb_IDIGNORE.Checked) then begin
- IDButton := 'IDIGNORE';
- IDButton2 := 'IDABORT';
- TypeMsg := 2;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
- end;
- end
- { selected button RETRY, IGNORE and ABORT }
- else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and cb_IDABORT.Checked and cb_IDIGNORE.Checked) then begin
- IDButton := 'IDRETRY';
- IDButton2 := 'IDIGNORE';
- IDButton3 := 'IDABORT';
- TypeMsg := 3;
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, IDButton3);
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, IDButton3);
- end;
- end
- { no selected buttons }
- else begin
- case ModeMsg of
- 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, '', '', '');
- 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, '', '', '');
- end;
- end;
- MSGTextInsert.Add(TextMsgIf);
- Result := MSGTextInsert.Text;
- finally
- MSGTextInsert.Free;
- end;
- end;
- end.
|