c++c++buildervcltlabel

C++ Builder TLabel sometimes gets Garbled Text


I have a simple form in which I set the text of a TLabel like so:

__fastcall TFacChoiceForm::TFacChoiceForm(TComponent* Owner) : TBaseForm(Owner)
{

    CaptionLabel->Text = "Hello User";
    FacSearchBar->SetFocus();
}

About fifty percent of the time, the text shows up in the TLabel just fine. However, the other fifty percent of the time the TLabel displays random garbled text. I noticed that if I tab through the controls on the form, the text will eventually reset itself. I have checked that even when the text is shown garbled, if I look at the TLabels' text in the debugger it is exactly what I would expect it to be. I'm not sure where to look in order to fix this.


Solution

  • I'm not sure why this solved the issue, but increasing the height of the label prevented the garbled text from appearing.