Re: Llama question
- Posted by David Cuny <dcuny at LANSET.COM> Jun 27, 1999
- 348 views
Derek Brown wrote: > Forgive my feeble mindedness ; ), but how do I use > the onOpen event to open a secondary window from the > main window? Or should I even use that event to > open the window? Well, I'd suggest uwing Win32Lib, unless you really like living on the bleeding edge. I haven't even tried opeing more than one window in Llama yet. Here's the code: procedure Main_onOpen() openWindow( MainMenu ) end procedure connect( Main, "onOpen", routine_id("Main_onOpen") ) The code is the same in Win32Lib, but instead of connect(), write: onOpen[ Main ] = routine_id( "Main_onOpen" ) Win32Lib and Llama cheat, in that they don't really "open" and "close" windows when you ask them to, they just make them invisible. It's all poorly explained somewhere in the documentation. When you make open a window (make it visible), the onOpen event is triggered. Well, I exagerate a bit. When you close the *main* window, it is really and truly closed, and your application is shut down. See the next bit. >WinMain(Main) >openWindow(MainMenu) The reason this fails is because WinMain is the event processing loop. The create() routine actually creates the windows, controls and menus at the time it's called, but the windows are invisible. When WinMain runs, it makes the main window visible, and then enters an event processing loop that runs until your main window shuts down: make the main window visible (triggers onOpen event) until the main window is destroyed process windows events end until So by the time openWindow() is reached in your example, the application has already shut down and destroyed all the controls. Hope this helps. -- David Cuny