BeginUpdate (C++)
Description
The following example adds a panel to the status bar control when you click the button and add a caption to the panel. The code uses BeginUpdate and EndUpdate to prevent repaints until the operation is complete. A try...finally block ensures that EndUpdate is called even when an exception occurs.
Code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  int PanelIndex;
  StatusBar1->Panels->BeginUpdate();
  PanelIndex = StatusBar1->Panels->Count - 1;
  try
  {
    StatusBar1->Panels->Add();
    PanelIndex++;
    StatusBar1->Panels->Items[PanelIndex]->Text = "Panel" + IntToStr(PanelIndex);
  }
  __finally
  {
    StatusBar1->Panels->EndUpdate();
  }
}
Uses
- System.Classes.TCollection.BeginUpdate ( fr | de | ja )
 - System.Classes.TCollection.EndUpdate ( fr | de | ja )
 - Vcl.ComCtrls.TStatusPanels.Add ( fr | de | ja )
 - System.Classes.TCollection.Count ( fr | de | ja )
 - Vcl.ComCtrls.TStatusPanels.Items ( fr | de | ja )