Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Moving focus

brad.bylls
Collaborator

Moving focus

brad.bylls
Collaborator
Collaborator

When using the combine command, when the user selects the target body the focus automatically shifts to the tools selection box.

I have a similar UI and would like to know how that focus shift is done.

I tried the tab key but that does not work.

Thanks.

Brad Bylls
0 Likes
Reply
Accepted solutions (1)
382 Views
3 Replies
Replies (3)

nnikbin
Collaborator
Collaborator
Accepted solution

@brad.bylls, in InputChangedEventHandler you can watch the changes of your SelectionCommandInput objects and if one of them changes and its selectionCount is greater than 0, switch the focus to the next SelectionCommandInput using SelectionCommandInput.hasFocus Property

1 Like

brad.bylls
Collaborator
Collaborator

Thanks for the input (pun intended 8^)

I understand what you are saying, but I don't know how to code it.

Can you help.

 

    def on_input_changed(selfcommandinputschanged_inputinput_values😞

        if changed_input.id == 'target':
            selection_input = inputs.itemById('tool')
            selection_input.hasFocus
 
. . . . . . . . . . . . more code . . . . . . . . . . . .
 
        # Create the command dialog
        _inputSelectTargets = inputs.addSelectionInput('target''Select The Target Body''Select the Body\nThat Will Be Cut')
        _inputSelectTargets.addSelectionFilter(adsk.core.SelectionCommandInput.Bodies)
        _inputSelectTargets.setSelectionLimits(11)

        _inputSelectTools = inputs.addSelectionInput('tool''Select The Tool Bodies''Select the Bodies\nThat Will Do The Cutting')
        _inputSelectTools.addSelectionFilter(adsk.core.SelectionCommandInput.Bodies)
        _inputSelectTools.setSelectionLimits(0)
Brad Bylls
0 Likes

brad.bylls
Collaborator
Collaborator

Of course just after sending you the reply, I figured it out.

Thanks for the help and pointing me in the right direction.

Brad Bylls
1 Like