vcl-dxstatusbar-7b886cc2.md
A state indicator.
TdxStatusBarStateIndicatorItem = class(
TCollectionItem
)
State indicators are simple colored UI elements designed to display enabled/disabled states for individual features in an application.
The list below outlines key members of the TdxStatusBarStateIndicatorItem class. These members allow you to configure state indicators.
IndicatorTypeAllows you to switch between available state indicator colors.VisibleSpecifies if the state indicator is visible.
CollectionProvides access to the parent state indicator collection.IndexSpecifies the indicator’s index in the parent collection.
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 following public API members reference a TdxStatusBarStateIndicatorItem object:
TdxStatusBarStateIndicators.AddCreates a state indicator and adds it to the collection.TdxStatusBarStateIndicators.InsertCreates a state indicator and inserts it at the specified position in the collection.TdxStatusBarStateIndicators.ItemsProvides indexed access to all state indicators stored in the collection.
TObject TPersistent TCollectionItem TdxStatusBarStateIndicatorItem
See Also