1. Focus issue

I actually found this with an IUP program, but realised it probably affects pretty much everything, and probably always has.
I took the standard windows.exw demo, you know the "A Plain Vanilla Window using Euphoria!" one that uses raw the windows API, and added

if wait_key() then end if 
--free_console() -- no help 

at the very start.

I tried it with:
Phix/p.exe - OK
Phix/pw.exe - bad
2.4/exw.exe - bad
2.4/exwc.exe - bad
4.0/eui.exe - bad

In all but one case the window did not actually get focus, so eg Alt-F4 would not close it, but would instead close the console underneath it.
I had hoped that free_console() would help, but apparently not. I can tell you that IupSetFocus() has no effect, not sure about other gui libs.
The fact the p.exe works must be related to it being a shared console or something, rather than any code difference (cmiiw).
Needless to say I would like it to work the same on pw.exe, with a non-shared console, and when run from Edita/Edix.
If you comment out the wait_key(), focus works fine again, so it is something about that, rather than the display/existence of a console.

Does anyone have any suggestions for how to "undo" having played with the console (ideally leaving it visible)?
Does anyone else get different results to me?


new topic     » topic index » view message » categorize

2. Re: Focus issue

I am not sure what you are doing, but i ran

include std/console.e -- added because in Pete's code "wait_key" is undefined 
if wait_key() then end if  
--free_console() -- no help  

and it opened a dos dox and accepted the anykey and closed properly.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Focus issue

If you take any program which opens a gui window, add a display/wait_key(), then afterwards the main window will appear but not get focus.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Focus issue

Hi Pete

I am not getting the same effect as you.

Using p and pw, the basic window has the focus (it appears above the console, and the title bar is the 'I have the focus' colour).

My expectation is that the console is linked to the program, so closing this will close the program, so I have never perceived this as a fault. If a separate thread is opened for the console, then I would expect it to close separately. The programmatically setting focus is a separate issue I think.



new topic     » goto parent     » topic index » view message » categorize


Quick Links

User menu

Not signed in.

Misc Menu