Recent

Author Topic: [SOLVED] TEdit not refreshing  (Read 5408 times)

carlangas

  • Jr. Member
  • **
  • Posts: 57
[SOLVED] TEdit not refreshing
« on: January 08, 2019, 08:38:28 pm »
I have tried with a TStatusBar to show the progress of an image processing function. It should display the number of the image that is being processed. The thing is that it does not update nor show any text until everything is over.

As it was the only thing I needed a TStatusBar and did not work as I expected, I replaced it with a TEdit, but I get the same.

It is something like this:

Code: Pascal  [Select][+][-]
  1. for Num:=1 to High(Imagenes) do
  2. begin
  3.   Edit1.Text:='Imagen '+IntToStr(Num);
  4.   Procesa(Imagenes[Num]);
  5. end;
  6.  

I only get the number of the last image in the array, and that once the loop has finished.

How can I force the TEdit to update before executing the next line?
« Last Edit: January 08, 2019, 10:28:17 pm by carlangas »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TEdit not refreshing
« Reply #1 on: January 08, 2019, 08:57:40 pm »
Add Application.ProcessMessages or Edit1.Repaint after the GUI control update:
Code: Pascal  [Select][+][-]
  1.   Edit1.Text:='Imagen '+IntToStr(Num);
  2.   Application.ProcessMessages;
  3.   {alternatively:
  4.     Edit1.Repaint;
  5.   }
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

carlangas

  • Jr. Member
  • **
  • Posts: 57
Re: TEdit not refreshing
« Reply #2 on: January 08, 2019, 10:27:51 pm »
Thanks. It works now. I had tried with Repaint without success, but ProcessMessages solved it.

 

TinyPortal © 2005-2018