- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hopefully this is a simple problem, but what I functionally want to do is use the .hasFocus method I've used in the past for selection inputs. It works great for them, but after digging through a bunch of errors I realized the method just doesn't seem to exist for text inputs.
Since I was in the documentation anyway (https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-a10df443-c843-4733-9111-6332f9410db2), I found the line below, saying that the .isEnabled method does exactly what I want. Perfect!
I'm struggling to get it to work though - it seems to be doing what the first sentence describes. Has this function been updated (and not the documentation) or am I using it wrong?
Also, if it has been updated, is there a way to replicate the .hasFocus method with text inputs?
Thanks a bunch for any help!
If necessary here's my implementation, it's pretty straight forward:
creating the input:
inputs.addTextBoxCommandInput('filepath', 'Path to write to:', f'Users/{username}/Downloads', 1, False)
inputs.addTextBoxCommandInput('creatorName', 'Creator Name', '', 1, False)
inputs.addTextBoxCommandInput('creatorEmail', 'Creator Email', '', 1, False)
inputs.addTextBoxCommandInput('description', 'Description', desc, 1, False)
inputs.addTextBoxCommandInput('releaseNotes', 'Release Notes', '', 1, False)
trying to change the focus:
def command_input_changed(args: adsk.core.InputChangedEventArgs):
changed_input = args.input
inputs = args.inputs
textInputs = ['filepath', 'creatorName', 'creatorEmail', 'description', 'releaseNotes']
if changed_input.id in textInputs:
if changed_input.text[-1] == '\t':
changed_input.text = changed_input.text[:-1]
next_input = textInputs[textInputs.index(changed_input.id) + 1]
ui.messageBox(f'Tab detected in {changed_input.id}, moving to {next_input}')
inputs.itemById(next_input).isEnabled = True
Solved! Go to Solution.