I am doing a REALBasic project. I want to make code run after the window has loaded automatically.

If I put the code in the Open event handler, the code runs when the window opens, but the window doesn't appear until the code has finished executing.

So I would like to have the Window open and be on the screen, and then the code run automatically without having to click anything.

Is this possible?

Thanks.

有帮助吗?

解决方案

Place your code in a Timer with its Mode set to ModeSingle and a short Period (say 10 milliseconds). The Timer will fire once the GUI finishes loading.

其他提示

Or you can put your code in a thread and start the thread in the Window.Open event. That way if the code takes a while your entire application doesn't 'freeze' on you.

More info on threads in Real Studio at http://docs.realsoftware.com/index.php/Thread

One word of caution though with Threads. Directly updating GUI controls can be a bad thing - especially with Cocoa built applications.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top