//--------------------------------------------------------------------------- void __fastcall TSynchronizeDialog::DoLog(TSynchronizeController * /*Controller*/, TSynchronizeLogEntry Entry, const UnicodeString Message) { LogView->Items->BeginUpdate(); try { TListItem * Item = LogView->Items->Add(); Item->Caption = Now().TimeString(); Item->SubItems->Add(Message); Item->MakeVisible(false); while (LogView->Items->Count > MaxLogItems) { LogView->Items->Delete(0); } } __finally { LogView->Items->EndUpdate(); if (Entry == slScan) { // redraw log before the scanning block update LogView->Repaint(); } } }
//--------------------------------------------------------------------------- void __fastcall TAuthenticateForm::Log(const UnicodeString Message) { TListItem * Item = LogView->Items->Add(); Item->Caption = Message; Item->MakeVisible(false); AdjustLogView(); LogView->Repaint(); }
//--------------------------------------------------------------------------- void __fastcall TSynchronizeChecklistDialog::StatusBarMouseDown( TObject * /*Sender*/, TMouseButton /*Button*/, TShiftState Shift, int X, int /*Y*/) { int IPanel = PanelAt(X); if (IPanel >= 0) { TListItem * Item = SelectAll(true, IPanel, Shift.Contains(ssCtrl)); if (Item != NULL) { Item->MakeVisible(false); Item->Focused = true; ListView->SetFocus(); } } }
//--------------------------------------------------------------------------- void TFScheduler::SetStatus(int prio, int time, int code) { int row = m_status->RowCount; m_status->Cells[0][row-1] = code; m_status->Cells[1][row-1] = prio; m_status->Cells[2][row-1] = "Pronto"; m_status->Cells[3][row-1] = time; m_status->RowCount++; TListItem * list = m_ls->Items->Add(); list->Caption = IntToStr(code); list->SubItems->Add("Processo em estado de criação"); list->ImageIndex = prio; list->MakeVisible(true); list->Selected = true; }
//--------------------------------------------------------------------------- void __fastcall TSynchronizeDialog::DoLogInternal( TSynchronizeLogEntry Entry, const UnicodeString & Message, TStrings * MoreMessages, TQueryType Type, const UnicodeString & HelpKeyword) { LogView->Items->BeginUpdate(); try { TListItem * Item = LogView->Items->Add(); TLogItemData * LogItemData = new TLogItemData(); Item->Data = LogItemData; LogItemData->Entry = Entry; LogItemData->Message = Message; if (MoreMessages != NULL) { LogItemData->MoreMessages.reset(new TStringList()); LogItemData->MoreMessages->Assign(MoreMessages); } LogItemData->Type = Type; LogItemData->HelpKeyword = HelpKeyword; Item->Caption = Now().TimeString(); UnicodeString UnformattedMessage = UnformatMessage(Message); UnformattedMessage = ReplaceStr(UnformattedMessage, L"\r", L""); UnformattedMessage = ReplaceStr(UnformattedMessage, L"\n", L" "); Item->SubItems->Add(UnformattedMessage); Item->MakeVisible(false); while (LogView->Items->Count > MaxLogItems) { LogView->Items->Delete(0); } } __finally { LogView->Items->EndUpdate(); if (Entry == slScan) { // redraw log before the scanning block update LogView->Repaint(); } } }
//--------------------------------------------------------------------------- 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(); } } }