Real Software Forums
http://forums.realsoftware.com/

Database.Connect() causes partial paint of Window (startup)
http://forums.realsoftware.com/viewtopic.php?f=3&t=47849
Page 1 of 1

Author:  contentengineer [ Sat May 11, 2013 7:48 am ]
Post subject:  Database.Connect() causes partial paint of Window (startup)

Does anyone have any guidance on where a Database.Connect() method should be called on application startup...as we are experiencing partial window drawing if there are connection issues - which is not particularly intuitive for users.

We have tried in Window.Open(), Window.Activate() [with a appStarting Boolean guard to stop it firing each time the window becomes frontmost]

However, in either of these instances the Window does not get fully drawn; and the application hangs particularly if the database connection is not available.

Should we be connecting to the database in a separate thread? Or is the effect just a side effect of using the debugger?

Any thoughts welcome!

Tested on:
MSSQL and MySQL databases, Windows Vista/Windows 7

Author:  DaveS [ Sat May 11, 2013 8:57 am ]
Post subject:  Re: Database.Connect() causes partial paint of Window (start

If you are going for a persistent connections (one that is live for the duration of the application)

I personally put the Connect in APP.OPEN

Author:  contentengineer [ Sat May 11, 2013 10:44 am ]
Post subject:  Re: Database.Connect() causes partial paint of Window (start

App.Open is a possible, though is the Database.Connect still a blocking call (i.e you have to wait to timeout before any other Window can be shown/repainted etc or any control e.g. a progress wheel is shown)? [We have tried Database.Multithreading=True but this is also blocking (in the debugger)]

It would be useful to know if there was any event firing/dispatch flowchart for starting and running Applications....has anybody ever published a "cheat sheet".

Perhaps we need to have a splash screen with a separate timer thread that spawns the persistent database connection (in the App) after a specified period of time.

Author:  DaveS [ Sat May 11, 2013 10:52 am ]
Post subject:  Re: Database.Connect() causes partial paint of Window (start

so in App.Open

SplashScreen.Show
connect to db
SplashScreen.Close
if db failed then
show msg
quit
end if


And no there is no cheat sheet.... the actual order of events is not as fixed as you might imagine... depends on your code, which OS etc.



Or for that matter... define the DB as a global property... but have the connection itself made INSIDE the splash screen.... that way the Splash is a self-contained object, and will close when the DB connect succeeds or fails.....

Author:  contentengineer [ Sat May 11, 2013 11:19 am ]
Post subject:  Re: Database.Connect() causes partial paint of Window (start

Thanks for looking at this. We have tried App.Open, but are still experiencing an issue with painting of the windows:

i.e. the SplashScreen window appears, but the labels do not; and only appear AFTER the db.Connect() times out?

Does anybody know if this is a feature of the MySQL/MSSQL library?
Or the debugger?

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/