Page 1 of 1

Focus rectangle on checkboxes

Posted: Thu Oct 22, 2009 3:42 pm
by Polly
When I tab through several checkboxes w/o xp skin I see a dotted rectangle that indicates the checkbox having the focus; when I activate xp skin I see nothing and must guess where I am currently - a behaviour which I nearly consider as a bug. (XP/PB 4.31 and 4.4b5)

So how can I indicate the focus with xp skin enabled?

For testing:

Code: Select all

  If OpenWindow(0, 0, 0, 270, 130, "CheckBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CheckBoxGadget(0, 10,  10, 250, 20, "CheckBox standard")
    CheckBoxGadget(1, 10,  40, 250, 20, "CheckBox checked") : SetGadgetState(1,1)
    CheckBoxGadget(2, 10,  70, 250, 20, "CheckBox right", #PB_CheckBox_Right)
    CheckBoxGadget(3, 10, 100, 250, 20, "CheckBox center", #PB_CheckBox_Center)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Re: Focus rectangle on checkboxes

Posted: Thu Oct 22, 2009 3:53 pm
by srod
I would wonder if PB is calling IsDialogMessage_() behind the scenes because whilst I can confirm your problem I have no such problems when using modal dialogs from PB (needs api).

Have a look at the following thread : http://www.purebasic.fr/english/viewtop ... ge#p275669

Re: Focus rectangle on checkboxes

Posted: Thu Oct 22, 2009 4:39 pm
by Sparkie

Re: Focus rectangle on checkboxes

Posted: Thu Oct 22, 2009 4:45 pm
by rsts
'fraid you can't take credit for this one. Insider information rule applies :)

You're still way ahead of most of us tho.

Re: Focus rectangle on checkboxes

Posted: Thu Oct 22, 2009 6:06 pm
by srod
Yes it's all very inconsistent here. Sometimes the focus rectangle appears; other times it does not!

Re: Focus rectangle on checkboxes

Posted: Fri Jan 15, 2010 1:22 pm
by Psych
Sorry to reply on old posts, but I'm just noticing this, and I am pretty sure older versions of the compiler didn't exhibit this behaviour, which may explain why it's only now coming up.

I don't have older versions installed, so I cannot test, but I am pretty sure focus rectangles showed before, because I can remember not 'liking' how they looked on vista (as I develop on XP, then test on my vista laptop), and the focus rectangle missing is not exclusive to checkboxes, but all gadgets (buttons too).

That said, we cannot rule out the behaviour changing due to a windows update, and while I understand the logic of not showing a rectangle while using the mouse, surely the rectangle should reappear when pressing the Tab key, as is the case with 'Internet Options' for example.

It's also worth mentioning that checkbox and button gadgets (and maybe others too) do not recieve the Focus and LostFocus event. I can only confirm that they are recieved on stringgadgets. Maybe this is why the gadget doesnt draw its rectangle behind the scenes.

Re: Focus rectangle on checkboxes

Posted: Fri Jan 15, 2010 1:32 pm
by Trond
The focus rectangle doesn't show up because it's turned off globally in Windows. To turn it on, go to display properties, appearance, effects and uncheck the box "hide underlined letters for keyboard navigation".

Re: Focus rectangle on checkboxes

Posted: Fri Jan 15, 2010 1:39 pm
by blueznl
Yeah, must be something like that, I just checked it here, and the dotted rectangle is there all the time. No issue here.

Re: Focus rectangle on checkboxes

Posted: Fri Jan 15, 2010 1:46 pm
by Psych
I would respectfully disagree, as far as I am aware, this behaviour is only apparent in PB compiled executables where the focus rectangle does not show up again (or at all) after pressing the tab key. As an example, open internet explorer, select internet options and test the behaviour on that dialog using the tab key and spacebar to highlight and select checkboxes and buttons, then select a fresh control using the mouse and the rectangle disappears, this is the correct behaviour IMHO. With the exception of text input based controls, all other controls should display a focus rectangle when the tab key is pressed to show the user what control has the focus.

Re: Focus rectangle on checkboxes

Posted: Fri Jan 15, 2010 2:18 pm
by Psych
Am I correct in assuming that the PB IDE is itself compiled using PB? Ironically, PB's own dialogs do not show the focus rectangle when using the tab key.

Anyone seen this on any other program? Before I convince myself it's a bug, I'd like to see it somewhere else.

Re: Focus rectangle on checkboxes

Posted: Fri Jan 15, 2010 2:38 pm
by Trond
Ok, there is a PB bug when the option mentioned above is checked. When the option is unchecked PB behaves correctly (shows the selection rectangle). But when checked, PB does not turn on the selection rectangle when using the tab key, which is a bug.

Although I must say this Windows option is retarted, especially making it checked by default, which should have been a criminal offence.

Re: Focus rectangle on checkboxes

Posted: Fri Jan 15, 2010 6:38 pm
by horst
Trond wrote:Ok, there is a PB bug when the option mentioned above is checked.
Agree. Just tested the behaviour on the FireFox settings window.

See also bug report: Disappearing button image when keyboard used, related to the same Windows option.
http://www.purebasic.fr/english/viewtop ... 46#p312346