On 19/11/2012 12:17, Eric Kom wrote:
On 19/11/2012 13:07, Michael Schnell wrote:
On 11/19/2012 11:01 AM, Eric Kom wrote:
the Connection procedure is declared as a private
This makes no difference at all.
("private" is just a visibility attribute and has no influence on the
functionality whatsoever. Please read the docs on the Object Pascal
language.)
Please did know a link that can send me to Object Pascal Language guide?
This isn't so much about object programming, but about event driven
programming.
Events are processed one by one. Your "Tfrmform1.Connection" is one
event. All other events are only processed, when this returns/finishes.
(or when you call Application.ProcessMessages)
"StatusBar.SimpleText := 'My name is Tux'; "
Does store the new caption, but not yet paint it. It triggers a paint
event, that will be processed later.
During the sleep no events are processed, so nothing is painted to the
screen.
You could call Application.ProcessMessages before the sleep. But
*warning*, this can get messy. During a Application.ProcessMessages your
event ("Tfrmform1.Connection") can be triggered and called again, like this:
StatusBar.SimpleText := 'My name is Tux';
Application.ProcessMessages;
StatusBar.SimpleText := 'My name is Tux';
Application.ProcessMessages
// ... and maybe called again ...
sleep(100);
StatusBar.SimpleText := 'am ready';
sleep(100);
StatusBar.SimpleText := 'am ready';
You can also try
StatusBar.Update;
This will (or should) do an immediate paint (do NOT call paint directly!)
Also note: during a sleep your app does not react. If a user resizez the
window, it will not paint. So if you put is longer sleeps, your app will
become none responsive to the user.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus