Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Refresh(), Paint(Draw& w), or something else nearby?
Re: Refresh(), Paint(Draw& w), or something else nearby? [message #10390 is a reply to message #10381] |
Thu, 05 July 2007 12:07   |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
The reason that this doesn't work is that Refresh doesn't call Paint immediately. Paint will only get called once and only after your code has finished.
One solution:
void Step()
{
bool quit = false;
Refresh();
ProcessEvents(&quit); // Force Refresh event to be executed
// If quit is true here then exit the app
}
Thie would draw each step as it is generated. I would advise against having the cell update code in Paint though.
And to fix the the TimerCallback problem of the step taking longer than the callback, if you change the timing from a negative to a positive number then you have to re-issue the callback every time it executes. This means you could complete the calculation of the next generation before you set the callback:
void OnTimer()
{
UpdateCells();
Refresh();
SetTimerCallback(40, THISBACK(OnTimer));
}
James
[Updated on: Thu, 05 July 2007 12:19] Report message to a moderator
|
|
|
 |
|
Refresh(), Paint(Draw& w), or something else nearby?
By: kverko on Wed, 04 July 2007 20:58
|
 |
|
Re: Refresh(), Paint(Draw& w), or something else nearby?
By: mrjt on Thu, 05 July 2007 12:07
|
 |
|
Re: Refresh(), Paint(Draw& w), or something else nearby?
By: kverko on Thu, 05 July 2007 21:15
|
 |
|
Re: Refresh(), Paint(Draw& w), or something else nearby?
By: mrjt on Fri, 06 July 2007 12:02
|
 |
|
Re: Refresh(), Paint(Draw& w), or something else nearby?
By: kverko on Fri, 06 July 2007 16:19
|
Goto Forum:
Current Time: Mon Aug 25 21:09:04 CEST 2025
Total time taken to generate the page: 0.05841 seconds
|