Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jul 05, 2006
- 713 views
Pete Stoner wrote: > > ZNorQ wrote: > > > > ChrisBurch2 wrote: > > > > > > ZNorQ wrote: > > > > > > > > ZNorQ wrote: > > > > > > > > > > Chris Burch wrote: > > > > > > > > > > > > Hi > > > > > > > > > > > > Hmmm, that is strange, it behaves as predicted on mine. > > > > > > > > > > > > > > > > > > }}} <eucode> > > > > > > -- code generated by Win32Lib IDE v0.19.1 > > > > > > > > > > > > > > > > > > include Win32Lib.ew > > > > > > without warning > > > > > > > > > > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > -- Window Window1 > > > > > > constant Window1 = createEx( Window, "Window1", 0, Default, Default, > > > > > > 400, 300, 0, 0 ) > > > > > > constant PushButton2 = createEx( PushButton, "Open sub", Window1, > > > > > > 56, 176, 88, 28, 0, 0 ) > > > > > > constant PushButton3 = createEx( PushButton, "Close", Window1, 180, > > > > > > 176, 88, 28, 0, 0 ) > > > > > > --------------------------------------------------------- > > > > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > -- Window Window2 > > > > > > constant Window2 = createEx( Window, "Window 2", 0, Default, > > > > > > Default, 285, 196, 0, 0 ) > > > > > > constant PushButton5 = createEx( PushButton, "Click me", Window2, > > > > > > 84, 76, 88, 28, 0, 0 ) > > > > > > --------------------------------------------------------- > > > > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > procedure PushButton2_onClick (integer self, integer event, sequence > > > > > > params)--params > > > > is () > > > > > > openDialog(Window2) > > > > > > end procedure > > > > > > setHandler( PushButton2, w32HClick, > > > > > > routine_id("PushButton2_onClick")) > > > > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > procedure PushButton3_onClick (integer self, integer event, sequence > > > > > > params)--params > > > > is () > > > > > > abort(0) > > > > > > end procedure > > > > > > setHandler( PushButton3, w32HClick, > > > > > > routine_id("PushButton3_onClick")) > > > > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > procedure PushButton5_onClick (integer self, integer event, sequence > > > > > > params)--params > > > > is () > > > > > > closeWindow(Window2) > > > > > > end procedure > > > > > > setHandler( PushButton5, w32HClick, > > > > > > routine_id("PushButton5_onClick")) > > > > > > > > > > > > > > > > > > WinMain( Window1,Normal ) > > > > > > > > > > > > </eucode> {{{ > > > > > > > > > > > > You cant close Window1 until you close Window2 > > > > > > > > > > > > Chris > > > > > > > > > > > > > > > > > > <a > > > > > > href="http://members.aol.com/chriscrylex/euphoria.htm">http://members.aol.com/chriscrylex/euphoria.htm</a> > > > > > > <a > > > > > > href="http://uboard.proboards32.com/">http://uboard.proboards32.com/</a> > > > > > > <a > > > > > > href="http://members.aol.com/chriscrylex/EUSQLite/eusql.html">http://members.aol.com/chriscrylex/EUSQLite/eusql.html</a> > > > > > > > > > > Your example worked perfectly, Chris. Strange that my original > > > > > code didn't work in the same manner.. Guess I'll have to try to > > > > > dig into the code and see what the heck I'm doing wrong here... > > > > > > > > > > Thanks anyway Chris. > > > > > > > > > > Kenneth > > > > > > > > Just noticed something. The thing is that the code does some integrity > > > > checks in some sequences before using WinMain command. And if there is > > > > an error in this checkroutine, it display my custom dialog - which means > > > > that the openDialog comes before the WinMain does.. Could this be the > > > > problem? > > > > > > > > Kenneth > > > > > > > > > Hi > > > > > > Yes, again I had a similar problem to this too. I may be way off base in > > > my > > > understanding, but I blieve that the dialog you are opening becomes the > > > parent > > > window of the program - the first window you open should be the parent, so > > > that > > > any subsequent dialogs opened are children to this, and can thus stop > > > execution of the parents. > > > > > > Now because you have opened the dialog first, subsequent windows think > > > they > > > are children, and carry on regardless (much like my real life ones) > > > > > > They way I got round this, was to open the main wind, then do the sequence > > > error checking, then open the error modal dialog window. > > > > > > Chris > > > > > > (PS, if anyone has a better, or more correct, explanation, please post it) > > > > Hey Chris, > > > > I understand. But my problem would then be - don't the WinMain actually > > stop the code and wait for user response? How would I make it continue > > with the error checking and display the dialog if any errors are detected? > > > > Kenneth > > Just a thought, but how about opening your main window first as normal but > hiding it (by positioning it offscreen), then having your integrity checks run > from an Activate or Open event (for your main window), if those run OK then > you can reposition your main window back on screen, otherwise display your > error > window... That way you have the correct parent and it will wait for a response > as you want.. > > PeteS Hey Pete, This does sound somewhat like Derek's proposal - and it did work. But rather than hiding it off screen, isn't there other commands that can do this? How about using showWindow with the 'hide' flag? I'll have a closer look into it! Thanks for your contribution, PeteS! :D Kenneth