Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #11  
Old 06-30-2016, 12:40 PM
robert robert is offline
Senior Member
 
Join Date: Sep 2014
Posts: 382
Default

Quote:
Originally Posted by Norrit View Post
So you click the button, start a timer (what that does, no idea), and fill the richedit text

Code:
Procedure TForm1.Timer1(Sender: TObject);
begin
guage.Progress := guage.Progress + 1;
end;
  #12  
Old 06-30-2016, 01:04 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,335
Default

Nice, but the answer to your problem was already in my last reply.
  #13  
Old 06-30-2016, 01:21 PM
robert robert is offline
Senior Member
 
Join Date: Sep 2014
Posts: 382
Default

Quote:
Originally Posted by Norrit View Post
So each time you press the button the richedit will update, since that's the only event that triggers it
I would've expected some update code directly after the Edit1.Text setter...
Completely bounced.
  #14  
Old 06-30-2016, 02:34 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,335
Default

Quote:
Completely bounced.
And that means???
  #15  
Old 06-30-2016, 03:02 PM
robert robert is offline
Senior Member
 
Join Date: Sep 2014
Posts: 382
Default

Quote:
Originally Posted by Norrit View Post
And that means???
Means I don't understand So each time you press the button the richedit will update
  #16  
Old 06-30-2016, 05:42 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,059
Default

Robert,

What exactly are you doing with the progress bar and the rich edit?

Give a complete explanation of what you are trying to achieve. Forget about the code. Tell us your needs only.
__________________
Regards,
Abdulaziz Jasser
  #17  
Old 06-30-2016, 07:08 PM
rojam rojam is offline
Senior Member
 
Join Date: Jun 2015
Posts: 199
Default

Quote:
Originally Posted by robert View Post
So each time you press the button the richedit will update
So HOW do you expect to update the progressbar progress position in the Edit control if you don't continually press the button since you only update the edit in the OnClick handler of the button?

The code to update the Edit Control with the new progressbar progress has to actually run for it to update the edit control. Just having the code in there...somewhere....doesn't update it.

Now your timer does continue to run while it updates the progress

Code:
Procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Gauge.Progress := Gauge.Progress + 1;
  Edit1.Text := StrToInt(Gauge.Progress);
  ...
  Richedit.SelText := ('waiting '+ edit.text);
  Timer1.Enabled := Gauge.Progress = Gauge.MaxValue;
end;

Last edited by rojam; 06-30-2016 at 07:20 PM.
  #18  
Old 06-30-2016, 07:45 PM
robert robert is offline
Senior Member
 
Join Date: Sep 2014
Posts: 382
Default

problem is not about edit1 or guage
Edit1.Text := StrToInt(Gauge.Progress); works well

problem is how can I use


Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer.Enable:=true;
richedit .seltext:=('line1'); 		
richedit .seltext:=('line2'); 		
richedit .seltext:=('waiting '+ edit.text); // this line is not updating
application.Processmessages;
end;
  #19  
Old 06-30-2016, 08:04 PM
rojam rojam is offline
Senior Member
 
Join Date: Jun 2015
Posts: 199
Default

You seem to miss the point of the last few posts. Ask yourself, WHEN does this code run. The answer to that is that it ONLY runs when you Click Button1. So how is the richedit to continually get updates from code that runs only once. The answer is that it can't.

It's pretty obvious that you misunderstand since you added application.processmessages to the code. Using processmessages will help solve your application freezing, usually within a long running loop (for/while or repeat loop). In this specific case, it has absolutely no (positive) value since there is no loop.
  #20  
Old 06-30-2016, 08:17 PM
robert robert is offline
Senior Member
 
Join Date: Sep 2014
Posts: 382
Default

If i use this approach

Code:
Procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Gauge.Progress := Gauge.Progress + 1;
  Edit1.Text := StrToInt(Gauge.Progress);
  ...
  Richedit.SelText := ('waiting '+ edit.text);
  Timer1.Enabled := Gauge.Progress = Gauge.MaxValue;
end;
in RichEdit lines are added as soon as guage is stepping ahead

waiting 1
waiting 2
waiting 3
-----
----
waiting 100

this makes a mess like .. whereas I was trying to achieve it in progressive manner.

waiting 1 then after 2 then after 3 and so on

I am really surprised that masters are getting failed to advise for this properly whereas I have an Delphi made exe. doing this

in exe. the line after lot of lines shows like text progress percentage with gauge progress.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:05 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.