I have two SelectionCommandInput as follows:
When the dialog is created, I would like to have the "Bodies" SelectionCommandInput to be selected.
To do this, I tried to make use of the `hasFocus` attribute, but that doesn't seem to work. `isEnabled` didn't work either. Am I doing something wrong? The following code is what I used.
# Function that is called when a user clicks the corresponding button in the UI.
# This defines the contents of the command dialog and connects to the command related events.
def command_created(args: adsk.core.CommandCreatedEventArgs):
# General logging for debug.
futil.log(f'{CMD_NAME} Command Created Event')
# TODO Connect to the events that are needed by this command.
futil.add_handler(args.command.execute, command_execute, local_handlers=local_handlers)
futil.add_handler(args.command.destroy, command_destroy, local_handlers=local_handlers)
# https://help.autodesk.com/view/fusion360/ENU/?contextId=CommandInputs
inputs = args.command.commandInputs
selectInput_1 = inputs.addSelectionInput(f"Selection_1", "Occurrences", f"Select Occurrences")
selectInput_1.addSelectionFilter("Occurrences")
selectInput_1.setSelectionLimits(0, 0)
selectInput_2 = inputs.addSelectionInput(f"Selection_2", "Bodies", f"Select Bodies")
selectInput_2.addSelectionFilter("Bodies")
selectInput_2.setSelectionLimits(0, 0)
selectInput_2.hasFocus = True
Hi @siliconlad -San.
I tried with a script and was able to reproduce the same phenomenon.
I thought of setting the focus not on the CommandCreated event, but on the Activate event that occurs afterwards, but the focus was still returned to selectInput_1 in the same way.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-eeb18ad8-6ea6-4a35-923f-c96113549704
I am having the same issue when I try and set hasFocus() inside my CommandCreatedEventHandler. Any solutions?
Can't find what you're looking for? Ask the community or share your knowledge.