Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mrjt is currently offline  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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using InstallKeyHook
Next Topic: Missing Functions for Layouter
Goto Forum:
  


Current Time: Mon Aug 25 21:09:04 CEST 2025

Total time taken to generate the page: 0.05841 seconds