1. Focus rectangle won't show
- Posted by wynco Dec 12, 2011
- 2803 views
This is a repeat of a problem I had in October 2011. Euphoric helped find a work around for my main program by using setIndex and setFocus on a ListView to cause the rectangle to appear. That works somewhat, although I've recently changed that to setting the focus to a TreeView then sending a Down then Up arrow to windows via sendMessage. This seems to work more consistently.
The problem now is that child windows have been added to the program. The focus rectangle will not show in any of them and some only have buttons and radio buttons, no TreeView or ListViews to tweek. One child window has 4 buttons and 12 radio buttons, navigating using the tab key without any indication of which object has focus is near impossible.
I am running Vista SP2, EU4, and win32lib v0.70.20
Is there a way to force windows to show a focus rectangle?
Here is a small sample to demonstrate the problem
include Win32lib.ew constant Main_Window = create(Window, "Main", 0, 100, 100, 100, 100, 0) constant Child_Window = create(Window, "Child", 0, 200, 200, 200, 200, 0) constant Button_One = create(PushButton, "Button One", Child_Window, 8, 4, 80, 40, 0) constant Radio_One = create(RadioButton, "Radio One", Child_Window, 8, 60, 100, 100, 0) openWindow({Child_Window, Button_One}, Normal) WinMain(Main_Window,Normal)
2. Re: Focus rectangle won't show
- Posted by DerekParnell (admin) Dec 12, 2011
- 2751 views
Is there a way to force windows to show a focus rectangle?
The problem is that when control is given to the user for the first time, the window that has focus is Main_Window. This happens because you first open the child window then you open the main_window, and the most recently opened window gets the focus.
And that means that the TAB key will shift focus amongst the controls in the Main_Window (because it has focus) and not any others. This gives the appearance that the Child Window has no focus rectangle.
So, instead of using the openWindow() routine in the manner you have now, try this instead ...
procedure ActivateMain(integer self, integer event, sequence parms) openWindow({Child_Window, Button_One}, Normal) end procedure setHandler(Main_Window, w32HActivate, routine_id("ActivateMain"))
This code will open the Main window first, which causes the Activate event to fire, thus opening the child window next, leaving focus with the child window.
3. Re: Focus rectangle won't show
- Posted by wynco Dec 12, 2011
- 2700 views
I see what your saying about the sample, however my actual program does not open any of the child windows until the user opens them via clicking a button or selecting from a menu. The main window is open and active before any child windows can be opened. I still get the same problem.
4. Re: Focus rectangle won't show
- Posted by wynco Dec 12, 2011
- 2701 views
I just modified my sample by adding the procedure recommended and it still has the same problem also.
5. Re: Focus rectangle won't show
- Posted by DerekParnell (admin) Dec 12, 2011
- 2715 views
I just modified my sample by adding the procedure recommended and it still has the same problem also.
Ok, but your example code works fine on my Windows 7 system.
Try explicitly setting focus to the child window when you open it. Something like ...
openWindow(childwin, Normal) setFocus(childWin) setFocus(childControl)
6. Re: Focus rectangle won't show
- Posted by wynco Dec 12, 2011
- 2706 views
I added the recommended setFocus changes but the problem still exist. Is there a way to explicitly tell windows to display a focus rectangle on an object?
7. Re: Focus rectangle won't show
- Posted by DerekParnell (admin) Dec 12, 2011
- 2725 views
I added the recommended setFocus changes but the problem still exist. Is there a way to explicitly tell windows to display a focus rectangle on an object?
I don't know of any but I 'binged' "windows api show focus rectangle" and got this as the first hit ...
It might be a Vista thing you are seeing.
This might help too ...
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx
8. Re: Focus rectangle won't show
- Posted by wynco Dec 13, 2011
- 2560 views
I went to the first link you provided and followed the directions there. It works. I'm wondering how many of the little problems are Vista bugs. Never did like Vista much. Thanks much!