//--------------------------------------------------------------------------- void __fastcall TSynchronizeProgressForm::Start() { FStarted = true; FStartTime = Now(); UpdateTimer->Enabled = true; StartTimeLabel->Caption = FStartTime.TimeString(); Caption = LoadStr(FCompareOnly ? SYNCHRONIZE_PROGRESS_COMPARE : SYNCHRONIZE_PROGRESS_SYNCHRONIZE); if (!IsApplicationMinimized()) { // Do not showing the progress when the application is minimized, // otherwise the form popups up unminimized. // Quick as dirty hack: with this form, we do not support showing it // once the application restores, // otherwise we would have to synchronize it somehow with the TProgressForm, // not to show it over the TProgressForm ShowAsModal(this, FShowAsModalStorage); } }
//--------------------------------------------------------------------------- bool __fastcall TAuthenticateForm::Execute(UnicodeString Status, TPanel * Panel, TWinControl * FocusControl, TButton * DefaultButton, TButton * CancelButton, bool FixHeight, bool Zoom, bool ForceLog) { TModalResult DefaultButtonResult; TAlign Align = Panel->Align; try { assert(FStatus.IsEmpty()); FStatus = Status; DefaultButton->Default = true; CancelButton->Cancel = true; DefaultButtonResult = DefaultResult(this); if (Zoom) { Panel->Align = alClient; } if (ForceLog || Visible) { if (ClientHeight < Panel->Height) { ClientHeight = Panel->Height; } // Panel being hidden gets not realigned automatically, even if it // has Align property set Panel->Top = ClientHeight - Panel->Height; Panel->Show(); TCursor PrevCursor = Screen->Cursor; try { if (Zoom) { LogView->Hide(); } else { if (LogView->Items->Count > 0) { TListItem * Item = LogView->ItemFocused; if (Item == NULL) { Item = LogView->Items->Item[LogView->Items->Count - 1]; } Item->MakeVisible(false); } } Screen->Cursor = crDefault; if (!Visible) { assert(ForceLog); ShowAsModal(); } ActiveControl = FocusControl; ModalResult = mrNone; AdjustControls(); do { Application->HandleMessage(); } while (!Application->Terminated && (ModalResult == mrNone)); } __finally { Panel->Hide(); Screen->Cursor = PrevCursor; if (Zoom) { LogView->Show(); } Repaint(); } } else { int PrevHeight = ClientHeight; int PrevMinHeight = Constraints->MinHeight; int PrevMaxHeight = Constraints->MaxHeight; try { Constraints->MinHeight = 0; ClientHeight = Panel->Height; if (FixHeight) { Constraints->MinHeight = Height; Constraints->MaxHeight = Height; } LogView->Hide(); Panel->Show(); FFocusControl = FocusControl; ShowModal(); } __finally { FFocusControl = NULL; ClientHeight = PrevHeight; Constraints->MinHeight = PrevMinHeight; Constraints->MaxHeight = PrevMaxHeight; Panel->Hide(); LogView->Show(); } } }