| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi, Trying to track down some subtle bugs in my app that may be related to reentry, Is it possible for a on timer event to trigger before a on shortcut event is finished or even the opposite... a on shortcut event before a on timer event is finished. A pointer to a document on these issues would be helpfull. many thanks, -rvg |
|
#2
| |||
| |||
| Robert Van Gemert wrote: > Hi, > > Trying to track down some subtle bugs in my app that may be related > to reentry, Is it possible for a on timer event to trigger before a > on shortcut event is finished or even the opposite... a on shortcut > event before a on timer event is finished. > > A pointer to a document on these issues would be helpfull. If you make the error of calling Application.ProcessMessages inside an event handler (any event handler) it can lead to another event being fired before the one you are in returns to the message loop. -- Peter Below (TeamB) Don't be a vampire (http://slash7.com/pages/vampires), use the newsgroup archives : http://www.tamaracka.com/search.htm http://groups.google.com |
|
#3
| |||
| |||
| "Robert Van Gemert" wrote > Trying to track down some subtle bugs in my app > that may be related to reentry, ... Have you checked for reentry? You know that you could add a boolean var InMyEvent and on entry to the event check that it is false and set it to true. Put the rest of the event code in a try-finally-end block where in the finally block you set InMyEvent back to false. If InMyEvent is not false at the entry you can check the calling stack. HTH, JohnH |
|
#4
| |||
| |||
| Peter & John, I was calling App.ProcessMessages!, intentionally but not fully realizing how it can break the windows message system. Thanks. -rvg |
|
#5
| |||
| |||
| In article <4899525c$1@newsgroups.borland.com>, "Robert Van Gemert" <rcvangemert@optushome.com.au> wrote: > Peter & John, > > I was calling App.ProcessMessages!, intentionally I've seen some here suggest that if you ever find you need to make this call, you know you are doing something wrong somewhere else. > but not fully realizing > how it can break the windows message system. Not sure if that is why they say it, perhaps it can break other things too! |
|
#6
| |||
| |||
| Robert Van Gemert wrote: > I was calling App.ProcessMessages!, intentionally but not fully realizing > how it can break the windows message system. It is not actually 'breaking' anything, it's doing exactly what you're telling it: That it's ok to activate another event handler before you have finished with the current one. If you don't realize what effect this will have on your program, don't use Application.ProcessMessages. If you for example have A.P in a long loop in an event (ButtonClick, for example), to keep the user interface 'responsive', then *every* button, menu item, mouse-over, etc. is allowed to be called *while you're still looping in the original event*. Google for "A.P considered harmful" or something like that, and I believe you can find code for a 'safe' message handler to call, if all you want to do is keeping the window visually updated during a longer calculation. Read up on threads if you want to do work in the background, while the UI is still fully responsive. -- Anders Isaksson, Sweden BlockCAD: http://web.telia.com/~u16122508/proglego.htm Gallery: http://web.telia.com/~u16122508/gallery/index.htm |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.