Strange Form behaviour at start

HARRY

Active Member
Licensed User
Longtime User
Hi.

A program has 4 forms, each with a flb object. The program uses the following libraries: FormLib, ImageLib, dzHW, RegistryDevice, FilesEx, ControlsExDevice, Hardware, ControlsEx and GPSdriver.

In App Start quite some objects are initialised; then the screen orientation is changed to landscape with Lndsc90.exe.

Then the form1 is shown and focus is set to it. Then for each form a number of flb settings are done, and a number of AddEvents are issued.

Next a number of bmp, drawer, rectangle objects are initialised on form2 and with AddTable a table is created on form1 and on form2.

Then a file is read to fill those tables. At filling time they are set to invisible. When filling is finished those tables are sorted, set to visible and a cell is selected in the table on the panel of form1.
Finally the focus is set to form1 and it is refreshed.

Now, how it behaves.

At start up during a while only a label on Form 1 is visible and the menu bar with Menu and SIP. The WaitCursor stops, 10 seconds later form1 becomes completely visible during a second or so and then disappears.

Pressing the icon in the titlebar shows Form1 as it should be and the program can run.

Does somebody have an explanation for this behaviour?

Harry
 

Cableguy

Expert
Licensed User
Longtime User
You should only execute the show method after all initialization is done, so probably in the last line of app_start...
when showing a form, it get the focus automatically...
Since you are first showing the form, and then initializing some object, your visible form takes some time to redraw completly untill all other "functions" are completed...
IF you must show the form before all object are initialized, the add a few "DoEvents" keywords and test the results...
placing a doevents alow the screen to be drawn, while the cpu is busy with other things...
The place were it lays is very important,thats why I said, put a few of them..
 

HARRY

Active Member
Licensed User
Longtime User
Hallo Paulo,

Thanks for your fast and helpfull reply. Postponing show to the very last moment and introducing some DoEvents have solved the problem.
Thanks again,

Harry
 
Top