Moving focus

Moving focus

brad.bylls
Collaborator Collaborator
619 Views
3 Replies
Message 1 of 4

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
Accepted solutions (1)
620 Views
3 Replies
Replies (3)
Message 2 of 4

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

Message 3 of 4

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
Message 4 of 4

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