SegmentedControl: Set focus to specific segment?

  1. 5 months ago

    Thomas E

    Jun 12 Pre-Release Testers

    In my Mac App I have a segmented control for a preference which is assigned during startup. So any segment could be selected.
    Now setting the focus to the SegmentedControl does always draw the focus ring to the first segment, only.
    A click to another segment does show the focus ring here. How can I set the focus ring to a specific segment?

    Even the Sample "Example Projects/Desktop/Controls/SegmentedControl.xojo_binary_project" does it wrong:
    Start the sample and click on "Select Earth"
    Result: Earth is selected but the focus ring is still on "Sun"

  2. Norman P

    Jun 12 Pre-Release Testers, Xojo Pro Outside

    you probably need to set segmentedcontrol.items().selected since a segemented control can have several of items items selected
    http://docs.xojo.com/SegmentedControlItem

  3. Thomas E

    Jun 12 Pre-Release Testers
    Edited 5 months ago

    Well, I do this. So the item is actually selected. It is just the focus ring which stays on the first item (as in the Xojo example, too).

    Meanwhile I looked further and I found a setKey handling in NSSegmentedCell. I guess "makePreviousSegmentKey()"/"makeNextSegmentKey()" would help but it seems so that there is no similar call from Xojo available…

  4. Alberto D

    Jun 12 Pre-Release Testers

    I can only do this:
    -image-

    I can't find a way to move the Focus or even remove the Focus. If I could remove the Focus then maybe is good enough just by using the selected item, right?

  5. Thomas E

    Jun 12 Pre-Release Testers

    @Alberto D;Poo If I could remove the Focus then maybe is good enough just by using the selected item, right?

    This would be Plan B (currently implemented).

or Sign Up to reply!