Hello!
There is a program that starts to connect to the database. I use firemonkey. Connection takes place in a separate stream, so that the main one would not wait in case of unsuccessful (long) connection. After a successful connection in the TSQLConnection
procedure - SQLConnection1AfterConnect
, the label
text is changed to "Online" and the GlowEffect
and placed in the label
container and the color changes to green.
Science fiction begins in the SQLConnection1AfterConnect
procedure. Sometimes the text of the label
'does not change, sometimes the GlowEffect
is not created, sometimes the GowEffect
is created, but without the green color, sometimes it is created with the green color (as it should). But after I do Hide
, and then Show
this window, then everything becomes as it should! Label
changes the text to the correct, GlowEffect
'color and becomes what you need.
I just don’t understand how it works here and what is happening. OnShow
window OnShow
disappeared ...
procedure TForm1.SQLConnection1AfterConnect(Sender: TObject); begin label1.Text:='В сети'; ConnectionGlowEffect:= TGlowEffect.Create(Form1); ConnectionGlowEffect.Parent:=label1; (label1.Children[1] AS TGlowEffect).GlowColor:=claChartreuse; (label1.Children[1] AS TGlowEffect).Enabled:=true; end;