CompMsgBoxDesigner.pas 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  1. unit CompMsgBoxDesigner;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2020 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. MessageBox Designer form
  8. Originally contributed by leserg73
  9. }
  10. interface
  11. uses
  12. Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  13. UIStateForm, StdCtrls, ExtCtrls, NewStaticText, ComCtrls, pngimage;
  14. type
  15. TMsgBoxDesignerForm = class(TUIStateForm)
  16. IMGmbInformation: TImage;
  17. IMGmbConfirmation: TImage;
  18. IMGmbError: TImage;
  19. IMGmbCriticalError: TImage;
  20. Panel1: TPanel;
  21. GroupBox1: TGroupBox;
  22. GroupBox2: TGroupBox;
  23. MSGText: TMemo;
  24. rb_mbInformation: TRadioButton;
  25. rb_mbConfirmation: TRadioButton;
  26. rb_mbError: TRadioButton;
  27. rb_mbCriticalError: TRadioButton;
  28. GroupBox3: TGroupBox;
  29. MBDButtonOK: TButton;
  30. MBDButtonCancel: TButton;
  31. MBDButtonPreview: TButton;
  32. Bevel1: TBevel;
  33. rbMB_OK: TRadioButton;
  34. rbMB_OKCANCEL: TRadioButton;
  35. rbMB_YESNO: TRadioButton;
  36. rbMB_YESNOCANCEL: TRadioButton;
  37. rbMB_RETRYCANCEL: TRadioButton;
  38. rbMB_ABORTRETRYIGNORE: TRadioButton;
  39. GroupBox4: TGroupBox;
  40. cb_IDOK: TCheckBox;
  41. cb_IDCANCEL: TCheckBox;
  42. cb_IDYES: TCheckBox;
  43. cb_IDNO: TCheckBox;
  44. cb_IDABORT: TCheckBox;
  45. cb_IDRETRY: TCheckBox;
  46. cb_IDIGNORE: TCheckBox;
  47. GroupBox5: TGroupBox;
  48. cb_MB_SETFOREGROUND: TCheckBox;
  49. NewStaticText1: TNewStaticText;
  50. NewEdit1: TEdit;
  51. UpDown1: TUpDown;
  52. GroupBox6: TGroupBox;
  53. cb_MsgBox: TRadioButton;
  54. cb_TaskDialogMsgBox: TRadioButton;
  55. rb_IDOK: TCheckBox;
  56. rb_IDCANCEL: TCheckBox;
  57. rb_IDYES: TCheckBox;
  58. rb_IDNO: TCheckBox;
  59. rb_IDABORT: TCheckBox;
  60. rb_IDRETRY: TCheckBox;
  61. rb_IDIGNORE: TCheckBox;
  62. TaskInstructionLabel: TNewStaticText;
  63. TaskMessageLabel: TNewStaticText;
  64. TaskInstructionText: TEdit;
  65. TaskMessageText: TEdit;
  66. Button1Text: TEdit;
  67. Button2Text: TEdit;
  68. Button1Label: TNewStaticText;
  69. Button2Label: TNewStaticText;
  70. cb_Suppressible: TCheckBox;
  71. cb_DefIDOK: TRadioButton;
  72. cb_DefIDCANCEL: TRadioButton;
  73. cb_DefIDYES: TRadioButton;
  74. cb_DefIDNO: TRadioButton;
  75. cb_DefIDABORT: TRadioButton;
  76. cb_DefIDRETRY: TRadioButton;
  77. cb_DefIDIGNORE: TRadioButton;
  78. procedure FormCreate(Sender: TObject);
  79. procedure UpDown1Changing(Sender: TObject; var AllowChange: Boolean);
  80. procedure rbMB_OKClick(Sender: TObject);
  81. procedure rbMB_OKCANCELClick(Sender: TObject);
  82. procedure rbMB_YESNOClick(Sender: TObject);
  83. procedure rbMB_RETRYCANCELClick(Sender: TObject);
  84. procedure rbMB_YESNOCANCELClick(Sender: TObject);
  85. procedure rbMB_ABORTRETRYIGNOREClick(Sender: TObject);
  86. procedure MBDButtonPreviewClick(Sender: TObject);
  87. procedure cb_TaskDialogMsgBoxClick(Sender: TObject);
  88. procedure cb_MsgBoxClick(Sender: TObject);
  89. procedure rb_IDOKClick(Sender: TObject);
  90. procedure rb_IDCANCELClick(Sender: TObject);
  91. procedure rb_IDNOClick(Sender: TObject);
  92. procedure rb_IDYESClick(Sender: TObject);
  93. procedure rb_IDRETRYClick(Sender: TObject);
  94. procedure rb_IDIGNOREClick(Sender: TObject);
  95. procedure rb_IDABORTClick(Sender: TObject);
  96. procedure cb_SuppressibleClick(Sender: TObject);
  97. procedure MSGTextKeyPress(Sender: TObject; var Key: Char);
  98. private
  99. function GetText: String;
  100. public
  101. property Text: string read GetText;
  102. end;
  103. implementation
  104. uses
  105. CmnFunc, CmnFunc2, CompFunc, TaskDialog, Msgs;
  106. {$R *.DFM}
  107. procedure TMsgBoxDesignerForm.FormCreate(Sender: TObject);
  108. begin
  109. InitFormFont(Self);
  110. cb_Suppressible.Checked := True;
  111. MSGText.Lines[MSGText.CaretPos.Y] := '<Enter your text here...>';
  112. MSGText.SelStart := MSGText.Perform(EM_LINEINDEX, 0, 0);
  113. MSGText.SelLength := Length(MSGText.Lines[0]);
  114. cb_IDCANCEL.Enabled := False;
  115. cb_IDABORT.Enabled := False;
  116. cb_IDRETRY.Enabled := False;
  117. cb_IDIGNORE.Enabled := False;
  118. cb_IDYES.Enabled := False;
  119. cb_IDNO.Enabled := False;
  120. NewStaticText1.Enabled := False;
  121. NewEdit1.Enabled := False;
  122. UpDown1.Enabled := False;
  123. TaskInstructionLabel.Visible := False;
  124. TaskMessageLabel.Visible := False;
  125. TaskInstructionText.Visible := False;
  126. TaskMessageText.Visible := False;
  127. Button1Text.Visible := False;
  128. Button2Text.Visible := False;
  129. Button1Label.Visible := False;
  130. Button2Label.Visible := False;
  131. end;
  132. procedure TMsgBoxDesignerForm.rbMB_OKClick(Sender: TObject);
  133. begin
  134. cb_IDOK.Checked := False;
  135. cb_IDCANCEL.Checked := False;
  136. cb_IDABORT.Checked := False;
  137. cb_IDRETRY.Checked := False;
  138. cb_IDIGNORE.Checked := False;
  139. cb_IDYES.Checked := False;
  140. cb_IDNO.Checked := False;
  141. cb_IDOK.Enabled := False;
  142. cb_IDCANCEL.Enabled := False;
  143. cb_IDABORT.Enabled := False;
  144. cb_IDRETRY.Enabled := False;
  145. cb_IDIGNORE.Enabled := False;
  146. cb_IDYES.Enabled := False;
  147. cb_IDNO.Enabled := False;
  148. NewStaticText1.Enabled := False;
  149. NewEdit1.Enabled := False;
  150. NewEdit1.Text := '1';
  151. UpDown1.Enabled := False;
  152. if cb_TaskDialogMsgBox.Checked then begin
  153. rb_IDOK.Enabled := True;
  154. rb_IDCANCEL.Enabled := False;
  155. rb_IDABORT.Enabled := False;
  156. rb_IDRETRY.Enabled := False;
  157. rb_IDIGNORE.Enabled := False;
  158. rb_IDYES.Enabled := False;
  159. rb_IDNO.Enabled := False;
  160. rb_IDOK.Checked := False;
  161. rb_IDCANCEL.Checked := False;
  162. rb_IDABORT.Checked := False;
  163. rb_IDRETRY.Checked := False;
  164. rb_IDIGNORE.Checked := False;
  165. rb_IDYES.Checked := False;
  166. rb_IDNO.Checked := False;
  167. Button2Text.Enabled := False;
  168. Button2Label.Enabled := False;
  169. Button1Text.Enabled := True;
  170. Button1Label.Enabled := True;
  171. Button1Text.Text := 'OK';
  172. Button2Text.Text := '';
  173. end;
  174. if cb_Suppressible.Checked then begin
  175. cb_DefIDOK.Checked := True;
  176. cb_DefIDCANCEL.Checked := False;
  177. cb_DefIDYES.Checked := False;
  178. cb_DefIDNO.Checked := False;
  179. cb_DefIDABORT.Checked := False;
  180. cb_DefIDRETRY.Checked := False;
  181. cb_DefIDIGNORE.Checked := False;
  182. cb_DefIDOK.Enabled := True;
  183. cb_DefIDCANCEL.Enabled := False;
  184. cb_DefIDYES.Enabled := False;
  185. cb_DefIDNO.Enabled := False;
  186. cb_DefIDABORT.Enabled := False;
  187. cb_DefIDRETRY.Enabled := False;
  188. cb_DefIDIGNORE.Enabled := False;
  189. end;
  190. end;
  191. procedure TMsgBoxDesignerForm.rbMB_YESNOClick(Sender: TObject);
  192. begin
  193. cb_IDOK.Checked := False;
  194. cb_IDCANCEL.Checked := False;
  195. cb_IDABORT.Checked := False;
  196. cb_IDRETRY.Checked := False;
  197. cb_IDIGNORE.Checked := False;
  198. cb_IDYES.Checked := False;
  199. cb_IDNO.Checked := False;
  200. cb_IDOK.Enabled := False;
  201. cb_IDCANCEL.Enabled := False;
  202. cb_IDABORT.Enabled := False;
  203. cb_IDRETRY.Enabled := False;
  204. cb_IDIGNORE.Enabled := False;
  205. cb_IDYES.Enabled := True;
  206. cb_IDNO.Enabled := True;
  207. if not cb_TaskDialogMsgBox.Checked then begin
  208. NewStaticText1.Enabled := True;
  209. NewEdit1.Enabled := True;
  210. NewEdit1.Text := '1';
  211. UpDown1.Max := 2;
  212. UpDown1.Enabled := True;
  213. end;
  214. if cb_TaskDialogMsgBox.Checked then begin
  215. rb_IDOK.Enabled := False;
  216. rb_IDCANCEL.Enabled := False;
  217. rb_IDABORT.Enabled := False;
  218. rb_IDRETRY.Enabled := False;
  219. rb_IDIGNORE.Enabled := False;
  220. rb_IDYES.Enabled := True;
  221. rb_IDNO.Enabled := True;
  222. rb_IDOK.Checked := False;
  223. rb_IDCANCEL.Checked := False;
  224. rb_IDABORT.Checked := False;
  225. rb_IDRETRY.Checked := False;
  226. rb_IDIGNORE.Checked := False;
  227. rb_IDYES.Checked := False;
  228. rb_IDNO.Checked := False;
  229. Button2Text.Enabled := True;
  230. Button2Label.Enabled := True;
  231. Button1Text.Enabled := True;
  232. Button1Label.Enabled := True;
  233. Button1Text.Text := 'Yes';
  234. Button2Text.Text := 'No';
  235. end;
  236. if cb_Suppressible.Checked then begin
  237. cb_DefIDOK.Checked := False;
  238. cb_DefIDCANCEL.Checked := False;
  239. cb_DefIDYES.Checked := True;
  240. cb_DefIDNO.Checked := False;
  241. cb_DefIDABORT.Checked := False;
  242. cb_DefIDRETRY.Checked := False;
  243. cb_DefIDIGNORE.Checked := False;
  244. cb_DefIDOK.Enabled := False;
  245. cb_DefIDCANCEL.Enabled := False;
  246. cb_DefIDYES.Enabled := True;
  247. cb_DefIDNO.Enabled := True;
  248. cb_DefIDABORT.Enabled := False;
  249. cb_DefIDRETRY.Enabled := False;
  250. cb_DefIDIGNORE.Enabled := False;
  251. end;
  252. end;
  253. procedure TMsgBoxDesignerForm.rbMB_OKCANCELClick(Sender: TObject);
  254. begin
  255. cb_IDOK.Checked := False;
  256. cb_IDCANCEL.Checked := False;
  257. cb_IDABORT.Checked := False;
  258. cb_IDRETRY.Checked := False;
  259. cb_IDIGNORE.Checked := False;
  260. cb_IDYES.Checked := False;
  261. cb_IDNO.Checked := False;
  262. cb_IDOK.Enabled := True;
  263. cb_IDCANCEL.Enabled := True;
  264. cb_IDABORT.Enabled := False;
  265. cb_IDRETRY.Enabled := False;
  266. cb_IDIGNORE.Enabled := False;
  267. cb_IDYES.Enabled := False;
  268. cb_IDNO.Enabled := False;
  269. if not cb_TaskDialogMsgBox.Checked then begin
  270. NewStaticText1.Enabled := True;
  271. NewEdit1.Enabled := True;
  272. NewEdit1.Text := '1';
  273. UpDown1.Max := 2;
  274. UpDown1.Enabled := True;
  275. end;
  276. if cb_TaskDialogMsgBox.Checked then begin
  277. rb_IDOK.Enabled := True;
  278. rb_IDCANCEL.Enabled := True;
  279. rb_IDABORT.Enabled := False;
  280. rb_IDRETRY.Enabled := False;
  281. rb_IDIGNORE.Enabled := False;
  282. rb_IDYES.Enabled := False;
  283. rb_IDNO.Enabled := False;
  284. rb_IDOK.Checked := False;
  285. rb_IDCANCEL.Checked := False;
  286. rb_IDABORT.Checked := False;
  287. rb_IDRETRY.Checked := False;
  288. rb_IDIGNORE.Checked := False;
  289. rb_IDYES.Checked := False;
  290. rb_IDNO.Checked := False;
  291. Button2Text.Enabled := False;
  292. Button2Label.Enabled := False;
  293. Button1Text.Enabled := True;
  294. Button1Label.Enabled := True;
  295. Button1Text.Text := 'OK';
  296. Button2Text.Text := '';
  297. end;
  298. if cb_Suppressible.Checked then begin
  299. cb_DefIDOK.Checked := True;
  300. cb_DefIDCANCEL.Checked := False;
  301. cb_DefIDYES.Checked := False;
  302. cb_DefIDNO.Checked := False;
  303. cb_DefIDABORT.Checked := False;
  304. cb_DefIDRETRY.Checked := False;
  305. cb_DefIDIGNORE.Checked := False;
  306. cb_DefIDOK.Enabled := True;
  307. cb_DefIDCANCEL.Enabled := True;
  308. cb_DefIDYES.Enabled := False;
  309. cb_DefIDNO.Enabled := False;
  310. cb_DefIDABORT.Enabled := False;
  311. cb_DefIDRETRY.Enabled := False;
  312. cb_DefIDIGNORE.Enabled := False;
  313. end;
  314. end;
  315. procedure TMsgBoxDesignerForm.rbMB_RETRYCANCELClick(Sender: TObject);
  316. begin
  317. cb_IDOK.Checked := False;
  318. cb_IDCANCEL.Checked := False;
  319. cb_IDABORT.Checked := False;
  320. cb_IDRETRY.Checked := False;
  321. cb_IDIGNORE.Checked := False;
  322. cb_IDYES.Checked := False;
  323. cb_IDNO.Checked := False;
  324. cb_IDOK.Enabled := False;
  325. cb_IDCANCEL.Enabled := True;
  326. cb_IDABORT.Enabled := False;
  327. cb_IDRETRY.Enabled := True;
  328. cb_IDIGNORE.Enabled := False;
  329. cb_IDYES.Enabled := False;
  330. cb_IDNO.Enabled := False;
  331. if not cb_TaskDialogMsgBox.Checked then begin
  332. NewStaticText1.Enabled := True;
  333. NewEdit1.Enabled := True;
  334. NewEdit1.Text := '1';
  335. UpDown1.Max := 2;
  336. UpDown1.Enabled := True;
  337. end;
  338. if cb_TaskDialogMsgBox.Checked then begin
  339. rb_IDOK.Enabled := False;
  340. rb_IDCANCEL.Enabled := True;
  341. rb_IDABORT.Enabled := False;
  342. rb_IDRETRY.Enabled := True;
  343. rb_IDIGNORE.Enabled := False;
  344. rb_IDYES.Enabled := False;
  345. rb_IDNO.Enabled := False;
  346. rb_IDOK.Checked := False;
  347. rb_IDCANCEL.Checked := False;
  348. rb_IDABORT.Checked := False;
  349. rb_IDRETRY.Checked := False;
  350. rb_IDIGNORE.Checked := False;
  351. rb_IDYES.Checked := False;
  352. rb_IDNO.Checked := False;
  353. Button2Text.Enabled := False;
  354. Button2Label.Enabled := False;
  355. Button1Text.Enabled := True;
  356. Button1Label.Enabled := True;
  357. Button1Text.Text := 'Retry';
  358. Button2Text.Text := '';
  359. end;
  360. if cb_Suppressible.Checked then begin
  361. cb_DefIDOK.Checked := False;
  362. cb_DefIDCANCEL.Checked := True;
  363. cb_DefIDYES.Checked := False;
  364. cb_DefIDNO.Checked := False;
  365. cb_DefIDABORT.Checked := False;
  366. cb_DefIDRETRY.Checked := False;
  367. cb_DefIDIGNORE.Checked := False;
  368. cb_DefIDOK.Enabled := False;
  369. cb_DefIDCANCEL.Enabled := True;
  370. cb_DefIDYES.Enabled := False;
  371. cb_DefIDNO.Enabled := False;
  372. cb_DefIDABORT.Enabled := False;
  373. cb_DefIDRETRY.Enabled := True;
  374. cb_DefIDIGNORE.Enabled := False;
  375. end;
  376. end;
  377. procedure TMsgBoxDesignerForm.rbMB_YESNOCANCELClick(Sender: TObject);
  378. begin
  379. cb_IDOK.Checked := False;
  380. cb_IDCANCEL.Checked := False;
  381. cb_IDABORT.Checked := False;
  382. cb_IDRETRY.Checked := False;
  383. cb_IDIGNORE.Checked := False;
  384. cb_IDYES.Checked := False;
  385. cb_IDNO.Checked := False;
  386. cb_IDOK.Enabled := False;
  387. cb_IDCANCEL.Enabled := True;
  388. cb_IDABORT.Enabled := False;
  389. cb_IDRETRY.Enabled := False;
  390. cb_IDIGNORE.Enabled := False;
  391. cb_IDYES.Enabled := True;
  392. cb_IDNO.Enabled := True;
  393. if not cb_TaskDialogMsgBox.Checked then begin
  394. NewStaticText1.Enabled := True;
  395. NewEdit1.Enabled := True;
  396. NewEdit1.Text := '1';
  397. UpDown1.Max := 3;
  398. UpDown1.Enabled := True;
  399. end;
  400. if cb_TaskDialogMsgBox.Checked then begin
  401. rb_IDOK.Enabled := False;
  402. rb_IDCANCEL.Enabled := True;
  403. rb_IDABORT.Enabled := False;
  404. rb_IDRETRY.Enabled := False;
  405. rb_IDIGNORE.Enabled := False;
  406. rb_IDYES.Enabled := True;
  407. rb_IDNO.Enabled := True;
  408. rb_IDOK.Checked := False;
  409. rb_IDCANCEL.Checked := False;
  410. rb_IDABORT.Checked := False;
  411. rb_IDRETRY.Checked := False;
  412. rb_IDIGNORE.Checked := False;
  413. rb_IDYES.Checked := False;
  414. rb_IDNO.Checked := False;
  415. Button2Text.Enabled := True;
  416. Button2Label.Enabled := True;
  417. Button1Text.Enabled := True;
  418. Button1Label.Enabled := True;
  419. Button1Text.Text := 'Yes';
  420. Button2Text.Text := 'No';
  421. end;
  422. if cb_Suppressible.Checked then begin
  423. cb_DefIDOK.Checked := False;
  424. cb_DefIDCANCEL.Checked := False;
  425. cb_DefIDYES.Checked := True;
  426. cb_DefIDNO.Checked := False;
  427. cb_DefIDABORT.Checked := False;
  428. cb_DefIDRETRY.Checked := False;
  429. cb_DefIDIGNORE.Checked := False;
  430. cb_DefIDOK.Enabled := False;
  431. cb_DefIDCANCEL.Enabled := True;
  432. cb_DefIDYES.Enabled := True;
  433. cb_DefIDNO.Enabled := True;
  434. cb_DefIDABORT.Enabled := False;
  435. cb_DefIDRETRY.Enabled := False;
  436. cb_DefIDIGNORE.Enabled := False;
  437. end;
  438. end;
  439. procedure TMsgBoxDesignerForm.rbMB_ABORTRETRYIGNOREClick(Sender: TObject);
  440. begin
  441. cb_IDOK.Checked := False;
  442. cb_IDCANCEL.Checked := False;
  443. cb_IDABORT.Checked := False;
  444. cb_IDRETRY.Checked := False;
  445. cb_IDIGNORE.Checked := False;
  446. cb_IDYES.Checked := False;
  447. cb_IDNO.Checked := False;
  448. cb_IDOK.Enabled := False;
  449. cb_IDCANCEL.Enabled := False;
  450. cb_IDABORT.Enabled := True;
  451. cb_IDRETRY.Enabled := True;
  452. cb_IDIGNORE.Enabled := True;
  453. cb_IDYES.Enabled := False;
  454. cb_IDNO.Enabled := False;
  455. if not cb_TaskDialogMsgBox.Checked then begin
  456. NewStaticText1.Enabled := True;
  457. NewEdit1.Enabled := True;
  458. NewEdit1.Text := '1';
  459. UpDown1.Max := 3;
  460. UpDown1.Enabled := True;
  461. end;
  462. if cb_TaskDialogMsgBox.Checked then begin
  463. rb_IDOK.Enabled := False;
  464. rb_IDCANCEL.Enabled := False;
  465. rb_IDABORT.Enabled := True;
  466. rb_IDRETRY.Enabled := True;
  467. rb_IDIGNORE.Enabled := True;
  468. rb_IDYES.Enabled := False;
  469. rb_IDNO.Enabled := False;
  470. rb_IDOK.Checked := False;
  471. rb_IDCANCEL.Checked := False;
  472. rb_IDABORT.Checked := False;
  473. rb_IDRETRY.Checked := False;
  474. rb_IDIGNORE.Checked := False;
  475. rb_IDYES.Checked := False;
  476. rb_IDNO.Checked := False;
  477. Button2Text.Enabled := False;
  478. Button2Label.Enabled := False;
  479. Button1Text.Enabled := False;
  480. Button1Label.Enabled := False;
  481. Button1Text.Text := '';
  482. Button2Text.Text := '';
  483. end;
  484. if cb_Suppressible.Checked then begin
  485. cb_DefIDOK.Checked := False;
  486. cb_DefIDCANCEL.Checked := False;
  487. cb_DefIDYES.Checked := False;
  488. cb_DefIDNO.Checked := False;
  489. cb_DefIDABORT.Checked := False;
  490. cb_DefIDRETRY.Checked := False;
  491. cb_DefIDIGNORE.Checked := True;
  492. cb_DefIDOK.Enabled := False;
  493. cb_DefIDCANCEL.Enabled := False;
  494. cb_DefIDYES.Enabled := False;
  495. cb_DefIDNO.Enabled := False;
  496. cb_DefIDABORT.Enabled := True;
  497. cb_DefIDRETRY.Enabled := True;
  498. cb_DefIDIGNORE.Enabled := True;
  499. end;
  500. end;
  501. procedure TMsgBoxDesignerForm.UpDown1Changing(Sender: TObject; var AllowChange: Boolean);
  502. begin
  503. AllowChange := True;
  504. end;
  505. procedure TMsgBoxDesignerForm.cb_MsgBoxClick(Sender: TObject);
  506. begin
  507. IMGmbConfirmation.Visible := True;
  508. cb_MB_SETFOREGROUND.Enabled := True;
  509. cb_MB_SETFOREGROUND.Checked := False;
  510. GroupBox1.Visible := True;
  511. if not cb_Suppressible.Checked then begin
  512. GroupBox4.Caption := ' Return values ';
  513. cb_DefIDOK.Visible := False;
  514. cb_DefIDCANCEL.Visible := False;
  515. cb_DefIDYES.Visible := False;
  516. cb_DefIDNO.Visible := False;
  517. cb_DefIDABORT.Visible := False;
  518. cb_DefIDRETRY.Visible := False;
  519. cb_DefIDIGNORE.Visible := False;
  520. end
  521. else begin
  522. GroupBox4.Caption := ' Return values / -------- / Default ';
  523. cb_DefIDOK.Visible := True;
  524. cb_DefIDCANCEL.Visible := True;
  525. cb_DefIDYES.Visible := True;
  526. cb_DefIDNO.Visible := True;
  527. cb_DefIDABORT.Visible := True;
  528. cb_DefIDRETRY.Visible := True;
  529. cb_DefIDIGNORE.Visible := True;
  530. end;
  531. cb_IDOK.Checked := False;
  532. cb_IDCANCEL.Checked := False;
  533. cb_IDABORT.Checked := False;
  534. cb_IDRETRY.Checked := False;
  535. cb_IDIGNORE.Checked := False;
  536. cb_IDYES.Checked := False;
  537. cb_IDNO.Checked := False;
  538. rb_IDOK.Visible := False;
  539. rb_IDCANCEL.Visible := False;
  540. rb_IDABORT.Visible := False;
  541. rb_IDRETRY.Visible := False;
  542. rb_IDIGNORE.Visible := False;
  543. rb_IDYES.Visible := False;
  544. rb_IDNO.Visible := False;
  545. rb_mbInformation.Checked := True;
  546. TaskInstructionLabel.Visible := False;
  547. TaskMessageLabel.Visible := False;
  548. TaskInstructionText.Visible := False;
  549. TaskMessageText.Visible := False;
  550. Button1Text.Visible := False;
  551. Button2Text.Visible := False;
  552. Button1Label.Visible := False;
  553. Button2Label.Visible := False;
  554. rbMB_OK.Checked := True;
  555. rbMB_OKClick(Self);
  556. end;
  557. procedure TMsgBoxDesignerForm.cb_SuppressibleClick(Sender: TObject);
  558. begin
  559. if cb_Suppressible.Checked then begin
  560. cb_DefIDOK.Visible := True;
  561. cb_DefIDCANCEL.Visible := True;
  562. cb_DefIDYES.Visible := True;
  563. cb_DefIDNO.Visible := True;
  564. cb_DefIDABORT.Visible := True;
  565. cb_DefIDRETRY.Visible := True;
  566. cb_DefIDIGNORE.Visible := True;
  567. if cb_MsgBox.Checked then
  568. GroupBox4.Caption := ' Return values / -------- / Default ';
  569. if cb_TaskDialogMsgBox.Checked then
  570. GroupBox4.Caption := ' Return values / Shield / Default ';
  571. end
  572. else begin
  573. cb_DefIDOK.Checked := False;
  574. cb_DefIDCANCEL.Checked := False;
  575. cb_DefIDYES.Checked := False;
  576. cb_DefIDNO.Checked := False;
  577. cb_DefIDABORT.Checked := False;
  578. cb_DefIDRETRY.Checked := False;
  579. cb_DefIDIGNORE.Checked := False;
  580. cb_DefIDOK.Visible := False;
  581. cb_DefIDCANCEL.Visible := False;
  582. cb_DefIDYES.Visible := False;
  583. cb_DefIDNO.Visible := False;
  584. cb_DefIDABORT.Visible := False;
  585. cb_DefIDRETRY.Visible := False;
  586. cb_DefIDIGNORE.Visible := False;
  587. if cb_MsgBox.Checked then
  588. GroupBox4.Caption := ' Return values ';
  589. if cb_TaskDialogMsgBox.Checked then
  590. GroupBox4.Caption := ' Return values / Shield ';
  591. end;
  592. if rbMB_OK.Checked then rbMB_OKClick(Self);
  593. if rbMB_OKCANCEL.Checked then rbMB_OKCANCELClick(Self);
  594. if rbMB_YESNO.Checked then rbMB_YESNOClick(Self);
  595. if rbMB_YESNOCANCEL.Checked then rbMB_YESNOCANCELClick(Self);
  596. if rbMB_RETRYCANCEL.Checked then rbMB_RETRYCANCELClick(Self);
  597. if rbMB_ABORTRETRYIGNORE.Checked then rbMB_ABORTRETRYIGNOREClick(Self);
  598. end;
  599. procedure TMsgBoxDesignerForm.cb_TaskDialogMsgBoxClick(Sender: TObject);
  600. begin
  601. IMGmbConfirmation.Visible := False;
  602. cb_MB_SETFOREGROUND.Enabled := False;
  603. cb_MB_SETFOREGROUND.Checked := False;
  604. GroupBox1.Visible := False;
  605. if not cb_Suppressible.Checked then begin
  606. GroupBox4.Caption := ' Return values / Shield ';
  607. cb_DefIDOK.Visible := False;
  608. cb_DefIDCANCEL.Visible := False;
  609. cb_DefIDYES.Visible := False;
  610. cb_DefIDNO.Visible := False;
  611. cb_DefIDABORT.Visible := False;
  612. cb_DefIDRETRY.Visible := False;
  613. cb_DefIDIGNORE.Visible := False;
  614. end
  615. else begin
  616. GroupBox4.Caption := ' Return values / Shield / Default ';
  617. cb_DefIDOK.Visible := True;
  618. cb_DefIDCANCEL.Visible := True;
  619. cb_DefIDYES.Visible := True;
  620. cb_DefIDNO.Visible := True;
  621. cb_DefIDABORT.Visible := True;
  622. cb_DefIDRETRY.Visible := True;
  623. cb_DefIDIGNORE.Visible := True;
  624. end;
  625. cb_IDOK.Checked := False;
  626. cb_IDCANCEL.Checked := False;
  627. cb_IDABORT.Checked := False;
  628. cb_IDRETRY.Checked := False;
  629. cb_IDIGNORE.Checked := False;
  630. cb_IDYES.Checked := False;
  631. cb_IDNO.Checked := False;
  632. rb_IDOK.Checked := False;
  633. rb_IDCANCEL.Checked := False;
  634. rb_IDABORT.Checked := False;
  635. rb_IDRETRY.Checked := False;
  636. rb_IDIGNORE.Checked := False;
  637. rb_IDYES.Checked := False;
  638. rb_IDNO.Checked := False;
  639. rb_IDOK.Visible := True;
  640. rb_IDCANCEL.Visible := True;
  641. rb_IDABORT.Visible := True;
  642. rb_IDRETRY.Visible := True;
  643. rb_IDIGNORE.Visible := True;
  644. rb_IDYES.Visible := True;
  645. rb_IDNO.Visible := True;
  646. rb_mbInformation.Checked := True;
  647. TaskInstructionLabel.Visible := True;
  648. TaskMessageLabel.Visible := True;
  649. TaskInstructionText.Visible := True;
  650. TaskMessageText.Visible := True;
  651. Button1Text.Visible := True;
  652. Button2Text.Visible := True;
  653. Button1Label.Visible := True;
  654. Button2Label.Visible := True;
  655. TaskInstructionText.Text := 'Instruction Text';
  656. TaskMessageText.Text := 'Message Text';
  657. // Button1Text.Text := '';
  658. // Button2Text.Text := '';
  659. rbMB_OK.Checked := True;
  660. rbMB_OKClick(Self);
  661. end;
  662. procedure TMsgBoxDesignerForm.rb_IDOKClick(Sender: TObject);
  663. begin
  664. if rb_IDOK.Checked then
  665. rb_IDCANCEL.Checked := False;
  666. end;
  667. procedure TMsgBoxDesignerForm.rb_IDCANCELClick(Sender: TObject);
  668. begin
  669. if rb_IDCANCEL.Checked then begin
  670. rb_IDOK.Checked := False;
  671. rb_IDNO.Checked := False;
  672. rb_IDYES.Checked := False;
  673. rb_IDRETRY.Checked := False;
  674. end;
  675. end;
  676. procedure TMsgBoxDesignerForm.rb_IDYESClick(Sender: TObject);
  677. begin
  678. if rb_IDYES.Checked then begin
  679. rb_IDNO.Checked := False;
  680. rb_IDCANCEL.Checked := False;
  681. end;
  682. end;
  683. procedure TMsgBoxDesignerForm.rb_IDNOClick(Sender: TObject);
  684. begin
  685. if rb_IDNO.Checked then begin
  686. rb_IDYES.Checked := False;
  687. rb_IDCANCEL.Checked := False;
  688. end;
  689. end;
  690. procedure TMsgBoxDesignerForm.rb_IDRETRYClick(Sender: TObject);
  691. begin
  692. if rb_IDRETRY.Checked then begin
  693. rb_IDCANCEL.Checked := False;
  694. rb_IDABORT.Checked := False;
  695. rb_IDIGNORE.Checked := False;
  696. end;
  697. end;
  698. procedure TMsgBoxDesignerForm.rb_IDIGNOREClick(Sender: TObject);
  699. begin
  700. if rb_IDIGNORE.Checked then begin
  701. rb_IDABORT.Checked := False;
  702. rb_IDRETRY.Checked := False;
  703. end;
  704. end;
  705. procedure TMsgBoxDesignerForm.rb_IDABORTClick(Sender: TObject);
  706. begin
  707. if rb_IDABORT.Checked then begin
  708. rb_IDIGNORE.Checked := False;
  709. rb_IDRETRY.Checked := False;
  710. end;
  711. end;
  712. procedure TMsgBoxDesignerForm.MBDButtonPreviewClick(Sender: TObject);
  713. var
  714. ButtonsBtn : Cardinal;
  715. TypeIcon : TMsgBoxType;
  716. CaptionMsg : String;
  717. ShieldFlag : Integer;
  718. ButtonLabelsArray: TArray<string>;
  719. begin
  720. { default value }
  721. ButtonsBtn := MB_OK;
  722. TypeIcon := mbInformation;
  723. ShieldFlag := 0;
  724. { icon and caption set }
  725. if rb_mbInformation.Checked then begin
  726. CaptionMsg := 'Info';
  727. TypeIcon := mbInformation;
  728. end;
  729. if rb_mbConfirmation.Checked then begin
  730. CaptionMsg := 'Confirm';
  731. TypeIcon := mbConfirmation;
  732. end;
  733. if rb_mbError.Checked then begin
  734. CaptionMsg := 'Error';
  735. TypeIcon := mbError;
  736. end;
  737. if rb_mbCriticalError.Checked then begin
  738. CaptionMsg := 'Fatal Error';
  739. TypeIcon := mbCriticalError;
  740. end;
  741. { button type set }
  742. if rbMB_OK.Checked then ButtonsBtn := MB_OK;
  743. if rbMB_OKCANCEL.Checked then ButtonsBtn := MB_OKCANCEL;
  744. if rbMB_YESNO.Checked then ButtonsBtn := MB_YESNO;
  745. if rbMB_YESNOCANCEL.Checked then ButtonsBtn := MB_YESNOCANCEL;
  746. if rbMB_RETRYCANCEL.Checked then ButtonsBtn := MB_RETRYCANCEL;
  747. if rbMB_ABORTRETRYIGNORE.Checked then ButtonsBtn := MB_ABORTRETRYIGNORE;
  748. { MsgBox(Text, Caption, Typ, Buttons); preview }
  749. if cb_MsgBox.Checked then begin
  750. if MSGText.GetTextLen = 0 then
  751. MSGText.Lines.Add('Your message text.');
  752. { MessageBox with DefButton }
  753. if NewEdit1.Text = '1' then
  754. MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn);
  755. if NewEdit1.Text = '2' then
  756. MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON2);
  757. if NewEdit1.Text = '3' then
  758. MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON3);
  759. { MessageBox with DefButton and Flag MB_SETFOREGROUND }
  760. if (NewEdit1.Text = '1') and (cb_MB_SETFOREGROUND.Checked) then
  761. MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_SETFOREGROUND);
  762. if (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
  763. MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON2 or MB_SETFOREGROUND);
  764. if (NewEdit1.Text = '3') and (cb_MB_SETFOREGROUND.Checked) then
  765. MsgBox(MSGText.Lines.GetText, CaptionMsg, TypeIcon, ButtonsBtn or MB_DEFBUTTON3 or MB_SETFOREGROUND);
  766. end;
  767. { TaskDialogMsgBox preview}
  768. if cb_TaskDialogMsgBox.Checked then begin
  769. { create ButtonLabels array }
  770. if rbMB_YESNO.Checked or rbMB_YESNOCANCEL.Checked then
  771. ButtonLabelsArray := TArray<string>.Create(Button1Text.Text, Button2Text.Text)
  772. else if rbMB_ABORTRETRYIGNORE.Checked then
  773. ButtonLabelsArray := TArray<string>.Create('Retry', 'Ignore', 'Abort')
  774. else
  775. ButtonLabelsArray := TArray<string>.Create(Button1Text.Text);
  776. { get Shield Flag value }
  777. if rbMB_OK.Checked and rb_IDOK.Checked then ShieldFlag := IDOK;
  778. if rbMB_OKCANCEL.Checked and rb_IDOK.Checked then ShieldFlag := IDOK;
  779. if rbMB_OKCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlag := IDCANCEL;
  780. if rbMB_YESNO.Checked and rb_IDYES.Checked then ShieldFlag := IDYES;
  781. if rbMB_YESNO.Checked and rb_IDNO.Checked then ShieldFlag := IDNO;
  782. if rbMB_YESNOCANCEL.Checked and rb_IDYES.Checked then ShieldFlag := IDYES;
  783. if rbMB_YESNOCANCEL.Checked and rb_IDNO.Checked then ShieldFlag := IDNO;
  784. if rbMB_YESNOCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlag := IDCANCEL;
  785. if rbMB_RETRYCANCEL.Checked and rb_IDRETRY.Checked then ShieldFlag := IDRETRY;
  786. if rbMB_RETRYCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlag := IDCANCEL;
  787. if rbMB_ABORTRETRYIGNORE.Checked and rb_IDRETRY.Checked then ShieldFlag := IDRETRY;
  788. if rbMB_ABORTRETRYIGNORE.Checked and rb_IDABORT.Checked then ShieldFlag := IDABORT;
  789. if rbMB_ABORTRETRYIGNORE.Checked and rb_IDIGNORE.Checked then ShieldFlag := IDIGNORE;
  790. { TaskDialogMsgBox(Icon, Instruction, Text, Caption, Typ, Buttons, ButtonLabels, ShieldButton) }
  791. TaskDialogMsgBox('',
  792. TaskInstructionText.Text,
  793. TaskMessageText.Text,
  794. CaptionMsg,
  795. TypeIcon,
  796. ButtonsBtn,
  797. ButtonLabelsArray,
  798. ShieldFlag);
  799. end;
  800. end;
  801. procedure TMsgBoxDesignerForm.MSGTextKeyPress(Sender: TObject; var Key: Char);
  802. begin
  803. if Key = #27 then begin
  804. MBDButtonCancel.Click;
  805. Key := #0;
  806. end;
  807. end;
  808. function TMsgBoxDesignerForm.GetText: String;
  809. { MsgBox / SuppressibleMsgBox }
  810. function TextMsg(M: Integer; a, b, c, d, e, f: String): String;
  811. { (M) - TypeMsg
  812. (a) - TextMsgIf
  813. (b) - IconTypes
  814. (c) - ButtonBtn
  815. (d) - IDButton
  816. (e) - IDButton2
  817. (f) - IDButton3 }
  818. var
  819. SMsg, TypeMsgBox : String;
  820. begin
  821. if not cb_Suppressible.Checked then
  822. TypeMsgBox := 'MsgBox'
  823. else
  824. TypeMsgBox := 'SuppressibleMsgBox';
  825. SMsg := TypeMsgBox + '(''' + a + ''', ' + b + ', ' + c + ')';
  826. case M of
  827. 0: Result := SMsg + ';';
  828. 1: Result := 'if ' + SMsg + ' = ' + d + ' then' + SNewLine + 'begin' + SNewLine + #9 + '// user clicked ' + StringReplace(d, 'ID', '', []) + SNewLine + 'end;';
  829. 2: Result := 'case ' + SMsg + ' of ' + SNewLine + #9 + d +': { user clicked ' + StringReplace(d, 'ID', '', []) + ' };' + SNewLine + #9 + e +': { user clicked ' + StringReplace(e, 'ID', '', []) + ' };' + SNewLine + 'end;';
  830. 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;';
  831. end;
  832. end;
  833. { TaskDialogMsgBox / SuppressibleTaskDialogMsgBox }
  834. function TextTask(N: Integer; a, b, c, r, s, d, e, f: String): String;
  835. { (N) - TypeMsg
  836. (a) - TextMsgIf (Button1Text.Text and Button2Text.Text)
  837. (b) - IconTypes
  838. (c) - ButtonBtn
  839. (r) - BtnTextArr
  840. (s) - ShieldFlg
  841. (d) - IDButton
  842. (e) - IDButton2
  843. (f) - IDButton3 }
  844. var
  845. STsg, TypeMsgBox : String;
  846. begin
  847. if not cb_Suppressible.Checked then
  848. TypeMsgBox := 'TaskDialogMsgBox'
  849. else
  850. TypeMsgBox := 'SuppressibleTaskDialogMsgBox';
  851. STsg := TypeMsgBox + '(''' + a + ''', ' + b + ', ' + c + ', [''' + r + '''], ' + s + ')';
  852. case N of
  853. 0: Result := STsg + ';';
  854. 1: Result := 'if ' + STsg + ' = ' + d + ' then' + SNewLine + 'begin' + SNewLine + #9 + '// user clicked ' + StringReplace(d, 'ID', '', []) + SNewLine + 'end;';
  855. 2: Result := 'case ' + STsg + ' of ' + SNewLine + #9 + d +': { user clicked ' + StringReplace(d, 'ID', '', []) + ' };' + SNewLine + #9 + e +': { user clicked ' + StringReplace(e, 'ID', '', []) + ' };' + SNewLine + 'end;';
  856. 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;';
  857. end;
  858. end;
  859. const
  860. remarka = '// Display a message box';
  861. var
  862. MSGTextInsert: TStringList;
  863. ButtonBtn, TextMsgIf, IconTypes : String;
  864. IDButton, IDButton2, IDButton3 : String;
  865. TypeMsg, ModeMsg : Integer;
  866. BtnTextArr, ShieldFlg, BtnSupprDef : String;
  867. begin
  868. { default value }
  869. ButtonBtn := 'MB_OK';
  870. IconTypes := 'mbInformation';
  871. ShieldFlg := '0';
  872. TypeMsg := 0;
  873. ModeMsg := 0;
  874. BtnSupprDef := '';
  875. { make a string with DefBtn for Suppressible }
  876. if cb_Suppressible.Checked then begin
  877. if cb_DefIDOK.Checked then BtnSupprDef := ', IDOK';
  878. if cb_DefIDCANCEL.Checked then BtnSupprDef := ', IDCANCEL';
  879. if cb_DefIDYES.Checked then BtnSupprDef := ', IDYES';
  880. if cb_DefIDNO.Checked then BtnSupprDef := ', IDNO';
  881. if cb_DefIDABORT.Checked then BtnSupprDef := ', IDABORT';
  882. if cb_DefIDRETRY.Checked then BtnSupprDef := ', IDRETRY';
  883. if cb_DefIDIGNORE.Checked then BtnSupprDef := ', IDIGNORE';
  884. end;
  885. { icon and caption set }
  886. if rb_mbInformation.Checked then begin
  887. IconTypes := 'mbInformation';
  888. end;
  889. if rb_mbConfirmation.Checked then begin
  890. IconTypes := 'mbConfirmation';
  891. end;
  892. if rb_mbError.Checked then begin
  893. IconTypes := 'mbError';
  894. end;
  895. if rb_mbCriticalError.Checked then begin
  896. IconTypes := 'mbCriticalError';
  897. end;
  898. { button type set }
  899. if rbMB_OK.Checked then ButtonBtn := 'MB_OK';
  900. if rbMB_OKCANCEL.Checked then ButtonBtn := 'MB_OKCANCEL';
  901. if rbMB_YESNO.Checked then ButtonBtn := 'MB_YESNO';
  902. if rbMB_YESNOCANCEL.Checked then ButtonBtn := 'MB_YESNOCANCEL';
  903. if rbMB_RETRYCANCEL.Checked then ButtonBtn := 'MB_RETRYCANCEL';
  904. if rbMB_ABORTRETRYIGNORE.Checked then ButtonBtn := 'MB_ABORTRETRYIGNORE';
  905. MSGTextInsert := TStringList.Create;
  906. try
  907. MSGTextInsert.Add(remarka);
  908. if cb_MsgBox.Checked then begin
  909. { MsgBox(Text, Typ, Buttons); }
  910. ModeMsg := 0;
  911. // rbMB_OK.Checked
  912. { MessageBox with DefButton }
  913. { MessageBox with DefButton and Flag MB_SETFOREGROUND }
  914. if (rbMB_OK.Checked) and (cb_MB_SETFOREGROUND.Checked) then
  915. ButtonBtn := 'MB_OK or MB_SETFOREGROUND';
  916. // rbMB_OKCANCEL
  917. { MessageBox with DefButton }
  918. if (rbMB_OKCANCEL.Checked) and (NewEdit1.Text = '2') then
  919. ButtonBtn := 'MB_OKCANCEL or MB_DEFBUTTON2';
  920. { MessageBox with DefButton and Flag MB_SETFOREGROUND }
  921. if (rbMB_OKCANCEL.Checked) and (cb_MB_SETFOREGROUND.Checked) then
  922. ButtonBtn := 'MB_OKCANCEL or MB_SETFOREGROUND';
  923. if (rbMB_OKCANCEL.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
  924. ButtonBtn := 'MB_OKCANCEL or MB_DEFBUTTON2 or MB_SETFOREGROUND';
  925. // rbMB_YESNO
  926. { MessageBox with DefButton }
  927. if (rbMB_YESNO.Checked) and (NewEdit1.Text = '2') then
  928. ButtonBtn := 'MB_YESNO or MB_DEFBUTTON2';
  929. { MessageBox with DefButton and Flag MB_SETFOREGROUND }
  930. if (rbMB_YESNO.Checked) and (cb_MB_SETFOREGROUND.Checked) then
  931. ButtonBtn := 'MB_YESNO or MB_SETFOREGROUND';
  932. if (rbMB_YESNO.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
  933. ButtonBtn := 'MB_YESNO or MB_DEFBUTTON2 or MB_SETFOREGROUND';
  934. // rbMB_RETRYCANCEL
  935. { MessageBox with DefButton }
  936. if (rbMB_RETRYCANCEL.Checked) and (NewEdit1.Text = '2') then
  937. ButtonBtn := 'MB_RETRYCANCEL or MB_DEFBUTTON2';
  938. { MessageBox with DefButton and Flag MB_SETFOREGROUND }
  939. if (rbMB_RETRYCANCEL.Checked) and (cb_MB_SETFOREGROUND.Checked) then
  940. ButtonBtn := 'MB_RETRYCANCEL or MB_SETFOREGROUND';
  941. if (rbMB_RETRYCANCEL.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
  942. ButtonBtn := 'MB_RETRYCANCEL or MB_DEFBUTTON2 or MB_SETFOREGROUND';
  943. // rbMB_YESNOCANCEL
  944. { MessageBox with DefButton }
  945. if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '2') then
  946. ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON2';
  947. if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '3') then
  948. ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON3';
  949. { MessageBox with DefButton and Flag MB_SETFOREGROUND }
  950. if (rbMB_YESNOCANCEL.Checked) and (cb_MB_SETFOREGROUND.Checked) then
  951. ButtonBtn := 'MB_YESNOCANCEL or MB_SETFOREGROUND';
  952. if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
  953. ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON2 or MB_SETFOREGROUND';
  954. if (rbMB_YESNOCANCEL.Checked) and (NewEdit1.Text = '3') and (cb_MB_SETFOREGROUND.Checked) then
  955. ButtonBtn := 'MB_YESNOCANCEL or MB_DEFBUTTON3 or MB_SETFOREGROUND';
  956. // rbMB_ABORTRETRYIGNORE
  957. { MessageBox with DefButton }
  958. if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '2') then
  959. ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON2';
  960. if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '3') then
  961. ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON3';
  962. { MessageBox with DefButton and Flag MB_SETFOREGROUND }
  963. if (rbMB_ABORTRETRYIGNORE.Checked) and (cb_MB_SETFOREGROUND.Checked) then
  964. ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_SETFOREGROUND';
  965. if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '2') and (cb_MB_SETFOREGROUND.Checked) then
  966. ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON2 or MB_SETFOREGROUND';
  967. if (rbMB_ABORTRETRYIGNORE.Checked) and (NewEdit1.Text = '3') and (cb_MB_SETFOREGROUND.Checked) then
  968. ButtonBtn := 'MB_ABORTRETRYIGNORE or MB_DEFBUTTON3 or MB_SETFOREGROUND';
  969. { Suppressible msg }
  970. if cb_Suppressible.Checked then ButtonBtn := ButtonBtn + BtnSupprDef;
  971. { replace in a message string escape /r/n }
  972. TextMsgIf := StringReplace(MSGText.Lines.GetText, SNewLine, '''#13#10''', [rfReplaceAll]);
  973. end;
  974. if cb_TaskDialogMsgBox.Checked then begin
  975. { TaskDialogMsgBox(TaskInstructionText.Text, TaskMessageText.Text, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg) }
  976. ModeMsg := 1;
  977. { create ButtonLabels array }
  978. if rbMB_YESNO.Checked or rbMB_YESNOCANCEL.Checked then
  979. BtnTextArr := Button1Text.Text + ''', ''' + Button2Text.Text
  980. else if rbMB_ABORTRETRYIGNORE.Checked then
  981. BtnTextArr := 'Retry'', ''Ignore'', ''Abort'
  982. else
  983. BtnTextArr := Button1Text.Text;
  984. { get Shield Flag value }
  985. if rbMB_OK.Checked and rb_IDOK.Checked then ShieldFlg := 'IDOK';
  986. if rbMB_OKCANCEL.Checked and rb_IDOK.Checked then ShieldFlg := 'IDOK';
  987. if rbMB_OKCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlg := 'IDCANCEL';
  988. if rbMB_YESNO.Checked and rb_IDYES.Checked then ShieldFlg := 'IDYES';
  989. if rbMB_YESNO.Checked and rb_IDNO.Checked then ShieldFlg := 'IDNO';
  990. if rbMB_YESNOCANCEL.Checked and rb_IDYES.Checked then ShieldFlg := 'IDYES';
  991. if rbMB_YESNOCANCEL.Checked and rb_IDNO.Checked then ShieldFlg := 'IDNO';
  992. if rbMB_YESNOCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlg := 'IDCANCEL';
  993. if rbMB_RETRYCANCEL.Checked and rb_IDRETRY.Checked then ShieldFlg := 'IDRETRY';
  994. if rbMB_RETRYCANCEL.Checked and rb_IDCANCEL.Checked then ShieldFlg := 'IDCANCEL';
  995. if rbMB_ABORTRETRYIGNORE.Checked and rb_IDRETRY.Checked then ShieldFlg := 'IDRETRY';
  996. if rbMB_ABORTRETRYIGNORE.Checked and rb_IDABORT.Checked then ShieldFlg := 'IDABORT';
  997. if rbMB_ABORTRETRYIGNORE.Checked and rb_IDIGNORE.Checked then ShieldFlg := 'IDIGNORE';
  998. { Suppressible msg }
  999. if cb_Suppressible.Checked then ShieldFlg := ShieldFlg + BtnSupprDef;
  1000. TextMsgIf := TaskInstructionText.Text + ''', ''' + TaskMessageText.Text;
  1001. end;
  1002. { selected button OK }
  1003. if (cb_IDOK.Checked and not cb_IDCANCEL.Checked) then begin
  1004. IDButton := 'IDOK';
  1005. TypeMsg := 1;
  1006. case ModeMsg of
  1007. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
  1008. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
  1009. end;
  1010. end
  1011. { selected button CANCEL }
  1012. 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
  1013. IDButton := 'IDCANCEL';
  1014. TypeMsg := 1;
  1015. case ModeMsg of
  1016. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
  1017. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
  1018. end;
  1019. end
  1020. { selected button OK and CANCEL }
  1021. 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
  1022. IDButton := 'IDOK';
  1023. IDButton2 := 'IDCANCEL';
  1024. TypeMsg := 2;
  1025. case ModeMsg of
  1026. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1027. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1028. end;
  1029. end
  1030. { selected button YES }
  1031. else if (cb_IDYES.Checked and not cb_IDNO.Checked and not cb_IDCANCEL.Checked) then begin
  1032. IDButton := 'IDYES';
  1033. TypeMsg := 1;
  1034. case ModeMsg of
  1035. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
  1036. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
  1037. end;
  1038. end
  1039. { selected button NO }
  1040. else if (cb_IDNO.Checked and not cb_IDYES.Checked and not cb_IDCANCEL.Checked) then begin
  1041. IDButton := 'IDNO';
  1042. TypeMsg := 1;
  1043. case ModeMsg of
  1044. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
  1045. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
  1046. end;
  1047. end
  1048. { selected button YES and NO }
  1049. else if (cb_IDYES.Checked and cb_IDNO.Checked and not cb_IDCANCEL.Checked) then begin
  1050. IDButton := 'IDYES';
  1051. IDButton2 := 'IDNO';
  1052. TypeMsg := 2;
  1053. case ModeMsg of
  1054. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1055. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1056. end;
  1057. end
  1058. { selected button YES and CANCEL }
  1059. else if (cb_IDYES.Checked and not cb_IDNO.Checked and cb_IDCANCEL.Checked) then begin
  1060. IDButton := 'IDYES';
  1061. IDButton2 := 'IDCANCEL';
  1062. TypeMsg := 2;
  1063. case ModeMsg of
  1064. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1065. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1066. end;
  1067. end
  1068. { selected button NO and CANCEL }
  1069. else if (cb_IDNO.Checked and not cb_IDYES.Checked and cb_IDCANCEL.Checked) then begin
  1070. IDButton := 'IDNO';
  1071. IDButton2 := 'IDCANCEL';
  1072. TypeMsg := 2;
  1073. case ModeMsg of
  1074. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1075. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1076. end;
  1077. end
  1078. { selected button YES, NO and CANCEL }
  1079. else if (cb_IDYES.Checked and cb_IDNO.Checked and cb_IDCANCEL.Checked) then begin
  1080. IDButton := 'IDYES';
  1081. IDButton2 := 'IDNO';
  1082. IDButton3 := 'IDCANCEL';
  1083. TypeMsg := 3;
  1084. case ModeMsg of
  1085. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, IDButton3);
  1086. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, IDButton3);
  1087. end;
  1088. end
  1089. { selected button RETRY }
  1090. else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and not cb_IDABORT.Checked and not cb_IDIGNORE.Checked) then begin
  1091. IDButton := 'IDRETRY';
  1092. TypeMsg := 1;
  1093. case ModeMsg of
  1094. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
  1095. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
  1096. end;
  1097. end
  1098. { selected button RETRY and CANCEL }
  1099. else if (cb_IDRETRY.Checked and cb_IDCANCEL.Checked and not cb_IDABORT.Checked and not cb_IDIGNORE.Checked) then begin
  1100. IDButton := 'IDRETRY';
  1101. IDButton2 := 'IDCANCEL';
  1102. TypeMsg := 2;
  1103. case ModeMsg of
  1104. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1105. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1106. end;
  1107. end
  1108. { selected button IGNORE }
  1109. else if (cb_IDIGNORE.Checked and not cb_IDCANCEL.Checked and not cb_IDABORT.Checked and not cb_IDRETRY.Checked) then begin
  1110. IDButton := 'IDIGNORE';
  1111. TypeMsg := 1;
  1112. case ModeMsg of
  1113. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
  1114. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
  1115. end;
  1116. end
  1117. { selected button ABORT }
  1118. else if (cb_IDABORT.Checked and not cb_IDCANCEL.Checked and not cb_IDRETRY.Checked and not cb_IDIGNORE.Checked) then begin
  1119. IDButton := 'IDABORT';
  1120. TypeMsg := 1;
  1121. case ModeMsg of
  1122. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, '', '');
  1123. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, '', '');
  1124. end;
  1125. end
  1126. { selected button RETRY and IGNORE }
  1127. else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and not cb_IDABORT.Checked and cb_IDIGNORE.Checked) then begin
  1128. IDButton := 'IDRETRY';
  1129. IDButton2 := 'IDIGNORE';
  1130. TypeMsg := 2;
  1131. case ModeMsg of
  1132. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1133. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1134. end;
  1135. end
  1136. { selected button RETRY and ABORT }
  1137. else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and cb_IDABORT.Checked and not cb_IDIGNORE.Checked) then begin
  1138. IDButton := 'IDRETRY';
  1139. IDButton2 := 'IDABORT';
  1140. TypeMsg := 2;
  1141. case ModeMsg of
  1142. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1143. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1144. end;
  1145. end
  1146. { selected button IGNORE and ABORT }
  1147. else if (not cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and cb_IDABORT.Checked and cb_IDIGNORE.Checked) then begin
  1148. IDButton := 'IDIGNORE';
  1149. IDButton2 := 'IDABORT';
  1150. TypeMsg := 2;
  1151. case ModeMsg of
  1152. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, '');
  1153. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, '');
  1154. end;
  1155. end
  1156. { selected button RETRY, IGNORE and ABORT }
  1157. else if (cb_IDRETRY.Checked and not cb_IDCANCEL.Checked and cb_IDABORT.Checked and cb_IDIGNORE.Checked) then begin
  1158. IDButton := 'IDRETRY';
  1159. IDButton2 := 'IDIGNORE';
  1160. IDButton3 := 'IDABORT';
  1161. TypeMsg := 3;
  1162. case ModeMsg of
  1163. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, IDButton, IDButton2, IDButton3);
  1164. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, IDButton, IDButton2, IDButton3);
  1165. end;
  1166. end
  1167. { no selected buttons }
  1168. else begin
  1169. case ModeMsg of
  1170. 0: TextMsgIf := TextMsg(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, '', '', '');
  1171. 1: TextMsgIf := TextTask(TypeMsg, TextMsgIf, IconTypes, ButtonBtn, BtnTextArr, ShieldFlg, '', '', '');
  1172. end;
  1173. end;
  1174. MSGTextInsert.Add(TextMsgIf);
  1175. Result := MSGTextInsert.Text;
  1176. finally
  1177. MSGTextInsert.Free;
  1178. end;
  1179. end;
  1180. end.