The online racing simulator
Form 'OnShow' event query
(4 posts, started )
#1 - Ian.H
Form 'OnShow' event query
Hi all..

I'm currently using BDS C++ 2006 to write a few simplish tools and was wondering if anyone had any ideas on how to get things to happen just _after_ the OnShow event?

For example, adding something that perhaps reads a directory that could contain a very large number of files into the OnShow event handler performs this task before the form is actually displayed, which isn't such a hot thing. Ideally, the form should display and then do whatever.

If anyone has any ideas either in C++ or Delphi (I don't know Delphi really, but can read it enough to port most to C++) I'd be interested in hearing them



Regards,

Ian
I can't do C++ or Delphi, but In JavaScript, there is a method "window.setTimeout(callback function, microseconds timeout)" that can make a function execute for example a second later than the onShow-Event, which will most likely give the program enough time to display its forms. maybe you can find such a function in C++ also. Good Luck
#3 - Ian.H
Thanks dude.. that sorted it (whether it's right or not is another story ).

I added a TTimer to the form as AFAIK, there's no "timeout" event for the form. The OnShow event now sets the Timer to Enabled = True and in the Timer event handler, checks for a period of 1/2 a second, calls the function to build the file list and disables the timer.. seems to work just fine

The Replay Manager app I'm working on was the biggest problem in this respect as it not only reads the spr and mpr dirs, reads each file and grabs various info too, which can obviously take some time if you have a large collection of replays.

Anyways, all's looking good now, thanks for the idea



Regards,

Ian
Attached images
lrm_07.png
Looks nice!

A Timer was what I was talkin about... It's called Timeout in Javascript so I called it like that

Greets

Form 'OnShow' event query
(4 posts, started )
FGED GREDG RDFGDR GSFDG