Remove focus ring on a Segmented control?

Hi,
When I create a segmented control and run the app - the default segment has an unwanted blue focus ring around it.
When I edit the segmented control - tick all the segments, and then untick them all, and then rerun my app - it works as expected (without the focus ring).

As soon as I run my app again - the focus ring reappears.
This means that every-other time I run my app - I need to tick and untick ALL segment controls in the editor.

This is really annoying, so I would like to ask if there is any way to force NO FOCUS to the segmented control.
In desperation I looked in the LF for an unsetFocus property - but as expected - it does not exist :frowning:

Thank you all in advance.

Clearfocus in the control open event…

Michel - where is ClearFocus in the LR?
I have looked at the properties etc. for Segmented Control, and see nothing of that description?

Thanks.

[quote=130176:@Richard Summers]Michel - where is ClearFocus in the LR?
I have looked at the properties etc. for Segmented Control, and see nothing of that description?

Thanks.[/quote]

It is not a control property.

http://documentation.xojo.com/index.php/ClearFocus

Thanks Michel.
Does that also remove the dotted lines which appear when you click on a button in Windows?

Thanks for the help :slight_smile:

This literally makes it so NO control has the focus - so shortcuts like pressing return or the space bar when a button has focus may not work (because nothing has focus).
Anything that depends or works because a control HAS focus won’t work if you call this.

Not drawing the focus ring is slightly different than calling clear focus

Ermm, so how would I remove any focus from a segmented control only?
Thanks.

The focus ring you might be able to use a declare on OS X as it is a native control - on Windows & Linux its custom

FOCUS - clear focus but thats more than JUST the focus ring as I said

I looked around for a declare that would remove the focus ring, but could not find one.

Another way can be to set the focus on another control when it comes to the segmented one. For instance, in the GotFocus of the segmented control :

TextField1.setfocus

Whatever control you want to keep the focus on, of course. Even a control outside of the page area, so it is invisible to the user.

That way the segmented control never gets focused.

What kind of app is this ? and what OS are you on ?
I’m not seeing any focus ring on OS X … hence my q

[quote=130242:@Norman Palardy]What kind of app is this ? and what OS are you on ?
I’m not seeing any focus ring on OS X … hence my q[/quote]

You are right Norman. The segmented control does not get the focus at all. And what I posted would not work, there is no gotfocus event…

What Richard is talking about must be the segment selection, then.

Ok,
I know everyone usually claims there is a bug, when in fact it is a coding error - but this must be a bug in Xojo.

My app is for OS X, and even if I set the focus to a text field, my segmented control still gets a focus ring around the selected segment. If I edit the segment control in the inspector, and select all segments, and then deselect them again, and then compile, it works as expected.

The next time I compile - the focus ring returns, and I have to go through the whole process again.
I am using the latest version of Xojo, and my previous version 2013 r3.1 also had the same problem.

Hope that made it clearer.

[quote=130250:@Richard Summers]Ok,
I know everyone usually claims there is a bug, when in fact it is a coding error - but this must be a bug in Xojo.

My app is for OS X, and even if I set the focus to a text field, my segmented control still gets a focus ring around the selected segment. If I edit the segment control in the inspector, and select all segments, and then deselect them again, and then compile, it works as expected.

The next time I compile - the focus ring returns, and I have to go through the whole process again.
I am using the latest version of Xojo, and my previous version 2013 r3.1 also had the same problem.

Hope that made it clearer.[/quote]

What you call focus ring must be a segment painted blue, right ?

If I did not understand, can you be so kind to post a screen grab ?

No - the segment becomes blue (just like a default button), but it also gets a blurry focus ring (like a text field).
I say this must be a bug because it only happens every other time I compile.

[quote=130253:@Richard Summers]No - the segment becomes blue (just like a default button), but it also gets a blurry focus ring (like a text field).
I say this must be a bug because it only happens every other time I compile.[/quote]

You can set the control to keep buttons unselected by putting this in the Open event :

me.SelectionType = 2

As for the focus ring, next time you see it, press cmd-shift-4 and copy the screen to a file. It will help for an eventual bug report.

Does it happen in a new project with a segmented control if you just run ?
I’m not seeing a blue ring so I’m trying to figure out how to reproduce this at all

Not sure Norman - but I will try it a bit later and let you know.
Thanks.

if you copy your segmented control into a new project does it occur there too ?

just trying to sort out what set up you have to see if theres any hints there

This is what I am referring to:

The segment is highlighted due to being set as the default segment - BUT - it also has the blurry focus ring around it?

Thanks.

What Xojo and Mac OS version are you using, Richard?
When I try this with 2014r2.1 and OS X 10.9, I see no focus ring: