How can I redraw a Window,
for example automatically all 10 seconds? Thanks, Katjana |
Katjana
You wrote in message news:[hidden email]... > How can I redraw a Window, > for example automatically all 10 seconds? Well one easy way is to set up a timer to invalidate it every 10 seconds. There are a couple of ways to do this: 1) Use a background process, for example, refreshing every 5 seconds: p := ClassHierarchyDiagram show. invalidater := [[Processor sleep: 5000. p isOpen] whileTrue: [p view invalidate]] fork 2) Use a Windows timer, as in the ProcessMonitor (if you have DSE or above). I would tend to faviour the latter for a task like this, since it makes sense to tie the lifetime of the refresh operation to the window, and also this will avoid any synchronisation issues. You'll be safe just invalidating a view from a background process, but should you decide you want to do something else for the refresh, e.g. repopulating a list, then you'll need to consider the usual thread synchronisation issues, all of which can be avoided by using a Windows timer. Regards Blair |
Thank you very much! :-)
Blair McGlashan schrieb: > Katjana > > You wrote in message news:[hidden email]... > >>How can I redraw a Window, >>for example automatically all 10 seconds? > > > Well one easy way is to set up a timer to invalidate it every 10 seconds. > There are a couple of ways to do this: > > 1) Use a background process, for example, refreshing every 5 seconds: > p := ClassHierarchyDiagram show. > > invalidater := [[Processor sleep: 5000. p isOpen] whileTrue: [p view > invalidate]] fork > > 2) Use a Windows timer, as in the ProcessMonitor (if you have DSE or above). > > I would tend to faviour the latter for a task like this, since it makes > sense to tie the lifetime of the refresh operation to the window, and also > this will avoid any synchronisation issues. You'll be safe just invalidating > a view from a background process, but should you decide you want to do > something else for the refresh, e.g. repopulating a list, then you'll need > to consider the usual thread synchronisation issues, all of which can be > avoided by using a Windows timer. > > Regards > > Blair > > |
In reply to this post by Blair McGlashan-2
Blair,
> 2) Use a Windows timer, as in the ProcessMonitor (if you have DSE or > above). > > I would tend to faviour the latter for a task like this Incidentally, View>>setTimer:interval: is still private. I believe you once said that you intended to make it public. Oh, and more incidentally still, is Bitmap>>canvas really intended to be private -- I find that I've had to use it in several places ? Am I missing something ? Would it help if I/we tried to identify all the private base-system methods that we call because we believe we have to (either because there's no alternative or because it seems the best man for the job)? E.g. my FMB used to call CompiledCode>>refersTo: but that was replaced by CompiledCode>>refersToLiteral: in 5.1. Since it was a private method, I couldn't very well complain that it had changed without warning, but I'd like to be able to avoid such problems where possible (and within reason). -- chris |
Chris
You wrote in message news:3eddc635$0$45186$[hidden email]... > Blair, > > > 2) Use a Windows timer, as in the ProcessMonitor (if you have DSE or > > above). > > > > I would tend to faviour the latter for a task like this > > Incidentally, View>>setTimer:interval: is still private. I believe you once > said that you intended to make it public. > > Oh, and more incidentally still, is Bitmap>>canvas really intended to be > private -- I find that I've had to use it in several places ? Am I missing > something ? These will be made public in PL2 (along with View>>killTimer:). > Would it help if I/we tried to identify all the private base-system methods > that we call because we believe we have to (either because there's no > alternative or because it seems the best man for the job)? >... Yes, it would help. Regards Blair |
Free forum by Nabble | Edit this page |