1. Win32lib focus problem-oh!
- Posted by George Henry <ghenryca at HOTMAIL.COM> Dec 05, 2000
- 473 views
-- focus.exw include \euphoria\userlib\win32lib.50\win32lib.ew constant winUno = create(Window, "Uno", 0, Default, Default, 200, 100, 0), btnUno = create(PushButton, "winDos", winUno, 10, 10, 50, 20, 0), winDos = create(Window, "Dos", winUno, Default, Default, 200, 100, 0), btnOK = create(PushButton, "OK", winDos, 10, 10, 50, 20, 0), btnCancel = create(PushButton, "Cancel", winDos, 70, 10, 50, 20, 0) procedure onClick_btnUno() openWindow(winDos, Modal) end procedure procedure onClick_btnOK() integer response response = message_box("Are you sure it's OK?", "Please confirm", MB_YESNOCANCEL) if response = IDYES then closeWindow(winDos) end if end procedure procedure onClick_btnCancel() closeWindow(winDos) end procedure onClick[btnUno] = routine_id("onClick_btnUno") onClick[btnOK] = routine_id("onClick_btnOK") onClick[btnCancel] = routine_id("onClick_btnCancel") WinMain(winUno, Normal) [end code] I posted a question about this yesterday, and no one has repsonded, so I thought I would make it easier to see what I'm talking about, and at the same time, by writing the simplest possible program to demonstrate it, determine whether something extraneous in my code was causing the problem. The code above does exactly what my code does, that I am concerned about. While running some other program (such as, hmm, your Web browser, for example), maximize that program. Then run the above program. Click on the "winDos" button, then click on the "OK" button. click on "Yes" in the message box. What happens? Is it what you would want to happen??? Now find winUno and click on the "winDos" button, then click on the "Cancel" button. How does the program behave differently this time? Finally, click on "winDos", then on "OK", click on "No" or "Cancel" in the message box, then click on "Cancel". NOW what happens? Why does invoking the message box from winDos cause the entire application to be shoved into the background when winDos is closed? And how can I prevent this from happening? I consider this a very serious (i.e. totally unacceptable) user interface flaw with my program. Please and thank you, George _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
2. Re: Win32lib focus problem-oh!
- Posted by Euman <euman at BELLSOUTH.NET> Dec 04, 2000
- 440 views
- Last edited Dec 05, 2000
Use setFocus(winUno) just after closeing winDos euman at bellsouth.net ----- Original Message ----- From: "George Henry" <ghenryca at HOTMAIL.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Monday, December 04, 2000 8:07 PM Subject: Win32lib focus problem-oh! > -- focus.exw > > include \euphoria\userlib\win32lib.50\win32lib.ew > > constant > winUno = create(Window, "Uno", 0, Default, Default, 200, 100, 0), > btnUno = create(PushButton, "winDos", winUno, 10, 10, 50, 20, 0), > winDos = create(Window, "Dos", winUno, Default, Default, 200, 100, 0), > btnOK = create(PushButton, "OK", winDos, 10, 10, 50, 20, 0), > btnCancel = create(PushButton, "Cancel", winDos, 70, 10, 50, 20, 0) > > procedure onClick_btnUno() > openWindow(winDos, Modal) > end procedure > > procedure onClick_btnOK() > integer response > response = message_box("Are you sure it's OK?", "Please confirm", > MB_YESNOCANCEL) > if response = IDYES then > closeWindow(winDos) > end if > end procedure > > procedure onClick_btnCancel() > closeWindow(winDos) > end procedure > > onClick[btnUno] = routine_id("onClick_btnUno") > onClick[btnOK] = routine_id("onClick_btnOK") > onClick[btnCancel] = routine_id("onClick_btnCancel") > > WinMain(winUno, Normal) > [end code] > > I posted a question about this yesterday, and no one has repsonded, so I > thought I would make it easier to see what I'm talking about, and at the > same time, by writing the simplest possible program to demonstrate it, > determine whether something extraneous in my code was causing the problem. > The code above does exactly what my code does, that I am concerned about. > > While running some other program (such as, hmm, your Web browser, for > example), maximize that program. Then run the above program. Click on the > "winDos" button, then click on the "OK" button. click on "Yes" in the > message box. What happens? Is it what you would want to happen??? > > Now find winUno and click on the "winDos" button, then click on the "Cancel" > button. How does the program behave differently this time? > > Finally, click on "winDos", then on "OK", click on "No" or "Cancel" in the > message box, then click on "Cancel". NOW what happens? > > Why does invoking the message box from winDos cause the entire application > to be shoved into the background when winDos is closed? And how can I > prevent this from happening? I consider this a very serious (i.e. totally > unacceptable) user interface flaw with my program. > > Please and thank you, > George > ____________________________________________________________________________ _________ > Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com >
3. Re: Win32lib focus problem-oh!
- Posted by Derek Parnell <DerekP at IXCHANGE.COM.AU> Dec 05, 2000
- 445 views
Hi George, >Why does invoking the message box from winDos cause the entire >application to be shoved into the background when winDos is >closed? And how can I prevent this from happening? I consider >this a very serious (i.e. totally unacceptable) user interface >flaw with my program. I suspect its because that message_box() is *not* a part of the win32lib library, thus it sets the "owner" window to NULL. When Windows closes, it has no knowledge of which window it was invoked from, so Windows just sets focus to some window. What method it uses I don't know, but I guess its not "last used". As a work around, you might need to specifically set the focus to the window of your choice via setFocus(id), when message_box() returns. I'm thinking of bring something like message_box into the library, in which case you can have much more control over its behaviour. ----- cheers Derek Parnell
4. Re: Win32lib focus problem-oh!
- Posted by George Henry <ghenryca at HOTMAIL.COM> Dec 05, 2000
- 445 views
Hi Derek, Thanks for the explanation. >I'm thinking of bring something like message_box into the library, in which >case you can have much more control over its behaviour. That idea gets my vote. George _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
5. Re: Win32lib focus problem-oh!
- Posted by Ad Rienks <kwibus at ZONNET.NL> Dec 06, 2000
- 454 views
----- Oorspronkelijk bericht ----- Van: Derek Parnell <DerekP at IXCHANGE.COM.AU> Aan: <EUPHORIA at LISTSERV.MUOHIO.EDU> Verzonden: dinsdag 5 december 2000 3:18 Onderwerp: Re: Win32lib focus problem-oh! > Hi George, > > >Why does invoking the message box from winDos cause the entire > >application to be shoved into the background when winDos is > >closed? And how can I prevent this from happening? I consider > >this a very serious (i.e. totally unacceptable) user interface > >flaw with my program. > > I suspect its because that message_box() is *not* a part of the win32lib > library, thus it sets the "owner" window to NULL. When Windows closes, it > has no knowledge of which window it was invoked from, so Windows just sets > focus to some window. What method it uses I don't know, but I guess its not > "last used". As a work around, you might need to specifically set the focus > to the window of your choice via setFocus(id), when message_box() returns. > > I'm thinking of bring something like message_box into the library, in which > case you can have much more control over its behaviour. > ----- > cheers > Derek Parnell I think message_box should *always* have an owner; maybe the fact that the Euphoria hasn't got one is the cause of consecutive message_boxes 'floating' towards the down left corner in my applications! Ad