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 » Parent continues before child is painted
Re: Parent continues before child is painted [message #45355 is a reply to message #45353] Sun, 01 November 2015 14:06 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
Agreed, this is really a bad design. Paint should basically be 'const' (although in special cases, this rule can be broken). Order is not guaranteed.

Now I can suggest two solution, based on what values you expect to 'compute' in Paint.

Model situation 1: You need some coordinates computed during Paint e.g. to use in LeftDown. If that is the case, separate painting into some routine other than ::Paint. In Paint, call this other routine. When you need coordinates computed, call this routine with "NilDraw". If there are some really heavy computation, you can add bool flag to avoid them.

Model situation 2: Some values displayed are slow to compute, you do not want to repeat this. In this case, use lazy evaluation/cache to compute them...

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TrayIcon Windows Shutdown solution
Next Topic: dynamic scatterDraw in a GUI
Goto Forum:
  


Current Time: Tue Sep 02 14:52:04 CEST 2025

Total time taken to generate the page: 0.06327 seconds