On Feb 15, 2007, at 7:04 PM, Tom Benson wrote:

I have a canvas subclass that draws itself based on the values of a dictionary property.

These values could be changed at any time by any running part of my application, so trying to trigger manual updates is a real headache. At the moment I put everything in the paint event, but it keeps refreshing and eats nearly half of my CPU...

So, what I want to do is create a separate property called lastRenderHash and save the state of the dictionary each time I render the image.

Then I put this in the paint event:

If me.dictionary.hash <> me.lastRenderHash then
        Update
end

Any other ideas??

I found a really easy solution to this kind of thing recently.

Put a timer in the window. When you need "at least one" refresh, turn the timer on. The timer has, say, a quarter-second period, after which it causes the refresh.

Whether one or fifty events require the refresh, once it's on, it's on... :-)

Regards,

Guyren G Howe
Relevant Logic LLC

guyren-at-relevantlogic.com ~ http://relevantlogic.com

REALbasic, PHP, Ruby/Rails, Python programming
PostgreSQL, MySQL database design and consulting
Technical writing and training


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to