Focus rectangle on checkboxes

Just starting out? Need help? Post your questions and find answers here.
Polly
User
User
Posts: 29
Joined: Sat Jan 19, 2008 10:31 pm

Focus rectangle on checkboxes

Post 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
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Focus rectangle on checkboxes

Post 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
I may look like a mule, but I'm not a complete ass.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Re: Focus rectangle on checkboxes

Post by Sparkie »

What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: Focus rectangle on checkboxes

Post 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.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Focus rectangle on checkboxes

Post by srod »

Yes it's all very inconsistent here. Sometimes the focus rectangle appears; other times it does not!
I may look like a mule, but I'm not a complete ass.
Psych
Enthusiast
Enthusiast
Posts: 239
Joined: Thu Dec 18, 2008 3:35 pm
Location: Wales, UK

Re: Focus rectangle on checkboxes

Post 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.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Focus rectangle on checkboxes

Post 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".
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Focus rectangle on checkboxes

Post 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.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Psych
Enthusiast
Enthusiast
Posts: 239
Joined: Thu Dec 18, 2008 3:35 pm
Location: Wales, UK

Re: Focus rectangle on checkboxes

Post 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.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Psych
Enthusiast
Enthusiast
Posts: 239
Joined: Thu Dec 18, 2008 3:35 pm
Location: Wales, UK

Re: Focus rectangle on checkboxes

Post 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.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Focus rectangle on checkboxes

Post 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.
horst
Enthusiast
Enthusiast
Posts: 197
Joined: Wed May 28, 2003 6:57 am
Location: Munich
Contact:

Re: Focus rectangle on checkboxes

Post 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
Horst.
Post Reply