I have a Splash Screen used for login. It is launched from the CUSTOM events in the main screen based on a user defined SENDMESSAGE in the CREATE EVENT on that same main screen. This allows the Splash Screen to display after the main form is fully displayed.
Until now the Splash screen did a little housekeeping in the CREATE EVENT that only took a few dozen milliseconds that all happened before the form displayed. Now I need to add a function that does some Internet I/O and it can take up to 10 seconds if it times out. Normally it only takes less than 1 second (not a problem). Because this is in the CREATE EVENT for the splash screen the screen does not appear until the timeout expires. The results of the Internet I/O also needs to be in a message on the Splash Screen so I cannot display it until the I/O completes.
My Problem
I decided that I could put a hidden label on the main screen that if un-hidden would "overlay" some of the controls on the page and say in a big red font "Please Wait, Internet Connection In Progress" or some other message to communicate to the user during a potential 10 second time out. Once the Splash Screen I/O was successful or timed out I would hide the label showing the message and then the Splash Screen would appear.
I have done a little experiment and I cannot get this label control with the message to overlay the others on the screen. I have (at design time) moved the control to the "front" but at runtime every control "shows through" the label.
I did try with a TextBox and it seems to cover the other controls. I can make the text box "Read Only" and not a TabStop and it will work like a label.
Is this simply a "feature" of a Label type control?
Would there be a better way so solve this problem?
Just reading your problem I am wondering why you don't create another Form that displays between the time that the Main form and the Splash form are displayed??? Instead of showing the Splash form via the user defined message, you show this new form that simply says "please wait... blah blah blah". When the internet connection finishes you PostMessage a user defined message to your Main form that displays the Splash screen. Seems simple to me... but of course this is just me thinking out loud.
Main Form
|
| (PostMessage to Main form CUSTOM)
|
Main Form (CUSTOM) (display "Waiting" Form - modal)
|
| (PostMessage to Main form CUSTOM)
|
Main Form (CUSTOM) (display "Splash/Logon" Form - modal)
Inserting a form in between the main form and the current splash form makes sense. I was just trying to avoid the problem of moving the logic from the splash form to the new "please wait" form.
Some of the stuff that is calculated in the CREATE EVENT on the splash form needs to display on the splash form. If the logic is in the "please wait" form can it populate labels on the splash form if it not yet "created"?
Here is another approach that you can use.
Create the Splash form. Then, create two more Forms that will display as child Forms of the Splash form. On one Form would be the Logon controls and the second Form would be the "Please Wait" Form. In the WM_CREATE of the Spalsh Form, simple load both child Forms as non-modal and show/hide them as needed. This is a technique that I use a lot. It is similar to the way the Tab Control works (showing and hiding child pages). It is simple to program and easy to maintain in the long run.
Paul,
I had not thought about that idea. I will do that on my "next one".
I did solve the problem by displaying a control on the main form (that launches the splash form). I ended up having to hide the underlying controls. It seems Windows "randomly" decides what controls cover up other controls. My testing showed labels don't work but text boxes do based on a small test program. When I put that in the "real" application it did not work. I just found a place on the screen to put the label control and hid two other controls. I put the label down in the corner of the screen and started out hidden so building the form was not so messy. When I decided I needed it I hid the other controls, resized the label, added the text, and un-hid it.
Ahhhhhh .... Windows
Thanks for the replies.