|
-
Feb 16th, 2004, 10:43 AM
#1
Thread Starter
Member
TopMost=True but not TopMost! / How to LOAD a form without Show
Background:
I have an application that runs in the background at all times, linked to a database. A component of this is the popup alert window. A key point of this form is that it must show without taking focus and always be on top. This I have done by setting ‘TopMost=True’.
This form has method (‘AddMessage’) that can add an additional msg from within the program itself and a ‘Check’ method that is called periodically and checks the database for messages. ‘AddMessage’ will immediately show the message box window if not already on display, ‘Check’ will only show the window if a msg was found in the database.
This is all working ok, until calls started to come in every now and then saying that the window was hidden behind there application windows.
Problem:
After some experimenting I have discovered that if the first message to popup originates from the database (‘Check’ method), then the window is indeed always ‘on top’ as planned and everything works fine.
If however the first message to popup originates from ‘AddMessage’ method, then it never stays on top – despite the fact that TopMost IS True (I have checked this at runtime too).
This has perplexed me since both ‘Check’ and ‘AddMessage’ call the same function to 'Show' the window when needed.
Theory:
I have a feeling this is something to do with the way the form loads, I noticed elsewhere on this same project that a form does not actually ‘load’ even when you use a user-defined method on it until you hit the ‘Show’ command.
As a test I then did a Form.Show for that form just before calling ‘AddMessage’ – and hey presto the form did stay on top. Trouble is, the AddMessage method does not always want the form to display (delayed/timed messages are entered here) so putting Form.Show before I call this results in empty popup alerts every so often.
Questions:
How do I FORCE a form to load without actually showing it?
Failing this, what on earth could be causing a TopMost=True form not to be TopMost?
Many thanks for any help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|