vcl-dxstatusbar-e32e1f10.md
A collection of state indicators in a status bar.
TdxStatusBarStateIndicators = class(
TOwnedCollection
)
An indicator panel is designed to display simple colored indicators within a status bar component.
The list below outlines key members of the TdxStatusBarStateIndicators class. These members allow you to manage a state indicator collection.
AddCreates a state indicator and adds it to the collection.ClearClears the collection.DeleteDeletes an individual state indicator in the collection.CountReturns the number of state indicators in the collection.InsertCreates a state indicator and inserts it to a specified position in the collection.ItemsProvides indexed access to state indicators in the collection.
AssignCopies indicator collections between panels.BeginUpdate | EndUpdateAllow you to avoid excessive redraw operations during batch indicator collection changes.
The following code example creates an indicator panel in an existing TdxStatusBarPanel component and populates the panel with five different indicators:
uses
dxStatusBar; // Declares the TdxStatusBarPanel component and all related types
// ...
var
AIndicatorPanel: TdxStatusBarPanel;
AIndicators: TdxStatusBarStateIndicators;
begin
AIndicatorPanel := dxStatusBar1.Panels.Add;
AIndicatorPanel.PanelStyleClass := TdxStatusBarStateIndicatorPanelStyle;
AIndicators := (AIndicatorPanel.PanelStyle as TdxStatusBarStateIndicatorPanelStyle).Indicators;
AIndicators.BeginUpdate; // Initiates the following batch change
try
AIndicators.Add.IndicatorType := sitRed;
AIndicators.Add.IndicatorType := sitYellow;
AIndicators.Add.IndicatorType := sitGreen;
AIndicators.Add.IndicatorType := sitPurple;
AIndicators.Add.IndicatorType := sitOff;
finally
AIndicators.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
#include "dxStatusBar.hpp" // Declares the TdxStatusBarPanel component and all related types
// Add the following linker directive to the corresponding CPP source file:
#pragma link "dxStatusBar" // Required to use dxStatusBar.hpp declarations
// ...
TdxStatusBarPanel *AIndicatorPanel;
TdxStatusBarStateIndicators *AIndicators;
AIndicatorPanel = dxStatusBar1->Panels->Add();
AIndicatorPanel->PanelStyleClass = __classid(TdxStatusBarStateIndicatorPanelStyle);
AIndicators = dynamic_cast<TdxStatusBarStateIndicatorPanelStyle*>(AIndicatorPanel->PanelStyle)->Indicators;
AIndicators->BeginUpdate(); // Initiates the following batch change
try
{
AIndicators->Add()->IndicatorType = sitRed;
AIndicators->Add()->IndicatorType = sitYellow;
AIndicators->Add()->IndicatorType = sitGreen;
AIndicators->Add()->IndicatorType = sitPurple;
AIndicators->Add()->IndicatorType = sitOff;
}
__finally
{
AIndicators->EndUpdate(); // Calls EndUpdate regardless of the batch operation's success
}
The TdxStatusBarStateIndicatorPanelStyle.Indicators property references a TdxStatusBarStateIndicators object.
TObject TPersistent TCollection TOwnedCollection TdxStatusBarStateIndicators
See Also