В данном примере будем показывать маску, во время синхронизации клиента и сервера, выглядеть это будет так…
Посмотрим на код
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIRegClasses, uniGUIForm, uniGUIBaseClasses, uniButton, uniLabel, uniProgressBar, uniImage, uniCheckBox, uniTimer, uniTreeView; type TMainForm = class(TUniForm) UniButton1: TUniButton; UniProgressBar1: TUniProgressBar; UniLabel1: TUniLabel; UniLabel2: TUniLabel; UniLabel3: TUniLabel; UniImage1: TUniImage; UniCheckBox1: TUniCheckBox; procedure UniButton1Click(Sender: TObject); procedure UniFormCreate(Sender: TObject); private procedure DoHideMask; procedure DoShowMask(const Msg: string); { Private declarations } public { Public declarations } end; function MainForm: TMainForm; implementation {$R *.dfm} uses uniGUIVars, MainModule, uniGUIApplication, ServerModule; function MainForm: TMainForm; begin Result := TMainForm(UniMainModule.GetFormInstance(TMainForm)); end; procedure TMainForm.DoHideMask; begin if UniCheckBox1.Checked then HideMask; end; procedure TMainForm.DoShowMask(const Msg: string); begin if UniCheckBox1.Checked then ShowMask(Msg); end; procedure TMainForm.UniButton1Click(Sender: TObject); begin UniLabel1.Caption := ''; UniLabel2.Caption := ''; UniLabel3.Caption := ''; UniCheckBox1.Enabled := False; UniImage1.Hide; UniProgressBar1.Position := 0; UniButton1.Enabled := False; DoShowMask('Level 1 in progress ..'); UniSession.Synchronize; Sleep(1000); UniProgressBar1.Position := 1; UniLabel1.Caption := 'Level 1 Completed'; UniLabel1.Font.Style := [fsBold]; DoHideMask; DoShowMask('Level 2 in progress ....'); UniSession.Synchronize; Sleep(1000); UniProgressBar1.Position := 2; UniLabel2.Caption := 'Level 2 Completed'; UniLabel2.Font.Style := [fsBold]; DoHideMask; DoShowMask('Level 3 in progress ......'); UniSession.Synchronize; Sleep(1000); UniProgressBar1.Position := 3; UniLabel3.Caption := 'Level 3 Completed'; UniLabel3.Font.Style := [fsBold]; DoHideMask; DoShowMask('Last level in progress ........'); UniSession.Synchronize; Sleep(1000); UniProgressBar1.Position := 4; UniImage1.Show; UniButton1.Enabled := True; UniCheckBox1.Enabled := True; DoHideMask; end; procedure TMainForm.UniFormCreate(Sender: TObject); begin UniImage1.Picture.LoadFromFile(UniServerModule.FilesFolderPath + 'done.gif'); end; initialization RegisterAppFormClass(TMainForm); end. |
Надо отметить, что ShowMask(Msg), и HideMask, это встроенные методы UniGUI. Маска показывается на всю форму.