I've got an issue here that is driving me nuts. I have several databases using a common library which has which defines many functions including WaitSeconds, and ShowMessage. WaitSeconds was the first function written which displays a modal form for the specified amount of seconds with a message in a label control. Later I decided to create the latter function which does the very same thing with a few more functionality. In addition to displaying a modal form and using the Timer event to close it only after the specified amount of time, it changes the background color and some font attributes of the message label to indicate when a message is critical as opposed to benign. Also, like VBs MsgBoxes, it calls some functions, API and custom, to format the text passed to it, determine the dimensions of a rectangle just big enough for the message, and resize the form, moving controls around to fit and all that fancy stuff. It also has 2 buttons either of which may be hidden depending on whether the form is opened as a timed form, or as a message requiring the user to dismiss it clicking one of the buttons.
The problem I am experiencing with this new approach is that when multiple databases are running simultaneously, and a background window causes this form to display, the focus switches from the window that had the focus to the one that most recently called the function. This can result in multiple flickering from one window to another because the function is called sometimes in a loop and numerous times throughout the cycle of the loop.
This is undesirable behaviour which according to documents I read online shouldnt require any effort on the part of the programmer to avoid post windows 95.
If anyone has any insight on this matter in what it is that Imay be doing wrong to cause this effect it will be very much appreciated. By the way, if I replace the new call to the old WaitSeconds call, the problem goes away but so do the new functionality programmed into the new approach
Thanks for any help
|
|