1. Llama question
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? I did the following:
------------------
include llama.ew
constant Main XXXXXXXXXXXX
constant MainMenu XXXXXXXXXXXX
WinMain(Main)
openWindow(MainMenu)
------------------
And it only opened the main window. Then I tried to do an onOpen event and I
couldn't make it work. Anyone know what I'm doing wrong?
(David, if you're reading this, you're the man!)
Thanks,
Derek
2. Re: Llama question
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
3. Re: Llama question
- Posted by Derek Brown <Cyrusbrown at AOL.COM>
Jun 27, 1999
-
Last edited Jun 28, 1999
Thanks David. Now that I think about it it makes sense.
Derek Brown