1. Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jun 30, 2006
- 811 views
I'm making an error routine with custom created error dialogs using standard windows for the purpose. My intention is to make the application wait for a user respons in case of an error. My problem is that the code continues and do not wait for that response... How do I go about? I use openWindow(WinID, Modal) to open en error dialog. Ken
2. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by Chris Burch <chriscrylex at aol.com> Jun 30, 2006
- 756 views
ZNorQ wrote: > > I'm making an error routine with custom created error dialogs using > standard windows for the purpose. My intention is to make the application wait > for a user respons in case of an error. My problem is that the code continues > and do not wait for that response... How do I go about? > > I use openWindow(WinID, Modal) to open en error dialog. > > Ken Hi Use openDialog(WinID) instead. That got me too at first. Chris http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html
3. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jul 03, 2006
- 721 views
Chris Burch wrote: > > ZNorQ wrote: > > > > I'm making an error routine with custom created error dialogs using > > standard windows for the purpose. My intention is to make the application > > wait > > for a user respons in case of an error. My problem is that the code > > continues > > and do not wait for that response... How do I go about? > > > > I use openWindow(WinID, Modal) to open en error dialog. > > > > Ken > > Hi > > Use openDialog(WinID) instead. > > That got me too at first. > > 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> Hey, Chris.. Strange, but that didn't work. The code continues to execute without waiting for a user repsonse..! ZNorQ
4. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by Chris Burch <chriscrylex at aol.com> Jul 03, 2006
- 722 views
Hi Hmmm, that is strange, it behaves as predicted on mine.
-- 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 )
You cant close Window1 until you close Window2 Chris http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html
5. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jul 03, 2006
- 706 views
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
6. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jul 03, 2006
- 716 views
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
7. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ChrisBurch2 <crylex at freeuk.co.uk> Jul 03, 2006
- 707 views
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)
8. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jul 04, 2006
- 734 views
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
9. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 04, 2006
- 721 views
You can use the w32HActivate event to do stuff after the main window is open but before the user gets to do anything. This is one place where you can check to see if there were any errors detected and close the application before the user can doing anything. Here is an example ...
--------------------------------- include Win32Lib.ew without warning integer Window1 integer PushButton2 integer PushButton3 integer Window2 integer Msg integer PushButton5 integer ErrCnt sequence ErrText procedure PushButton2_onClick (integer self, integer event, sequence params) openDialog(Window2) end procedure procedure PushButton3_onClick (integer self, integer event, sequence params) closeApp() end procedure procedure PushButton5_onClick (integer self, integer event, sequence params) closeWindow(Window2) end procedure procedure Window1_onActivate (integer self, integer event, sequence params) if ErrCnt > 0 then setText(Msg, {"%d errors detected\n%s", {ErrCnt, ErrText}}) setText(PushButton5, "Abort") openDialog(Window2) closeApp() end if end procedure procedure main() -- Do some checking prior to opening the main window. integer fh object Line ErrCnt = 0 ErrText = "" fh = open("missing.file", "r") if fh = -1 then ErrCnt += 1 ErrText &= "'missing.file' is missing\n" else -- Check first line. Line = gets(fh) if atom(Line) then ErrCnt += 1 ErrText &= "The file is empty\n" elsif not equal(Line, "good one\n") then ErrCnt += 1 ErrText &= "The first line is not 'good one'\n" -- Check second line. Line = gets(fh) if atom(Line) then ErrCnt += 1 ErrText &= "The second line is missing\n" elsif not equal(Line, "last line\n") then ErrCnt += 1 ErrText &= "The second line is not 'last line'\n" end if end if end if Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) PushButton2 = createEx( PushButton, "Open sub", Window1, 56, 176, 88, 28, 0, 0 ) PushButton3 = createEx( PushButton, "Close", Window1, 180, 176, 88, 28, 0, 0 ) Window2 = createEx( Window, "Window 2", 0, Default, Default, 285, 196, 0, 0 ) Msg = createEx( Label, "", Window2, 10, 10 , 200, 120, 0, 0) PushButton5 = createEx( PushButton, "Click me", Window2, 84, 130, 88, 28, 0, 0 ) setHandler( PushButton2, w32HClick, routine_id("PushButton2_onClick")) setHandler( PushButton3, w32HClick, routine_id("PushButton3_onClick")) setHandler( PushButton5, w32HClick, routine_id("PushButton5_onClick")) setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) WinMain( Window1,Normal ) end procedure main() ---------------------------------
-- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
10. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by Pete Stoner <stoner.pete at gmail.com> Jul 04, 2006
- 719 views
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
11. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jul 05, 2006
- 729 views
Derek Parnell wrote: > > You can use the w32HActivate event to do stuff after the main window is open > but before the user gets to do anything. This is one place where you can check > to see if there were any errors detected and close the application before the > user can doing anything. Here is an example ... > > }}} <eucode> > --------------------------------- > include Win32Lib.ew > without warning > > integer Window1 > integer PushButton2 > integer PushButton3 > integer Window2 > integer Msg > integer PushButton5 > integer ErrCnt > sequence ErrText > > procedure PushButton2_onClick (integer self, integer event, sequence params) > openDialog(Window2) > end procedure > > procedure PushButton3_onClick (integer self, integer event, sequence params) > closeApp() > end procedure > > procedure PushButton5_onClick (integer self, integer event, sequence params) > closeWindow(Window2) > end procedure > > procedure Window1_onActivate (integer self, integer event, sequence params) > if ErrCnt > 0 then > setText(Msg, {"%d errors detected\n%s", {ErrCnt, ErrText}}) > setText(PushButton5, "Abort") > openDialog(Window2) > closeApp() > end if > end procedure > > procedure main() > > -- Do some checking prior to opening the main window. > integer fh > object Line > > ErrCnt = 0 > ErrText = "" > > fh = open("missing.file", "r") > if fh = -1 then > ErrCnt += 1 > ErrText &= "'missing.file' is missing\n" > else > -- Check first line. > Line = gets(fh) > if atom(Line) then > ErrCnt += 1 > ErrText &= "The file is empty\n" > elsif not equal(Line, "good one\n") then > ErrCnt += 1 > ErrText &= "The first line is not 'good one'\n" > -- Check second line. > Line = gets(fh) > if atom(Line) then > ErrCnt += 1 > ErrText &= "The second line is missing\n" > elsif not equal(Line, "last line\n") then > ErrCnt += 1 > ErrText &= "The second line is not 'last line'\n" > end if > end if > end if > > Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 > ) > PushButton2 = createEx( PushButton, "Open sub", Window1, 56, 176, 88, 28, > 0, 0 ) > PushButton3 = createEx( PushButton, "Close", Window1, 180, 176, 88, 28, 0, > 0 ) > Window2 = createEx( Window, "Window 2", 0, Default, Default, 285, 196, 0, > 0 ) > Msg = createEx( Label, "", Window2, 10, 10 , 200, 120, 0, 0) > PushButton5 = createEx( PushButton, "Click me", Window2, 84, 130, 88, 28, > 0, 0 ) > > setHandler( PushButton2, w32HClick, routine_id("PushButton2_onClick")) > setHandler( PushButton3, w32HClick, routine_id("PushButton3_onClick")) > setHandler( PushButton5, w32HClick, routine_id("PushButton5_onClick")) > setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) > > WinMain( Window1,Normal ) > end procedure > > main() > --------------------------------- > </eucode> {{{ > > -- > Derek Parnell > Melbourne, Australia > Skype name: derek.j.parnell Hey Derek, That worked! Thanks again! Oh, btw, I asked you about a tool tip that didn't show all the text I needed it to show - and you spoke of some sort of a fix.. You remember? (Sorry, abit off topic) Kenneth
12. Re: Making a window dialog wait for a user response (Win32Lib)
- Posted by ZNorQ <znorq at holhaug.com> Jul 05, 2006
- 746 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