Hide label next to button input

Hide label next to button input

alex14
Explorer Explorer
427 Views
2 Replies
Message 1 of 3

Hide label next to button input

alex14
Explorer
Explorer

I need to add a "refresh" button that refreshes the items in a dropdown control in a command I've created (these items are sourced from an external platform). That's fairly easy to do by calling command.commandInputs.addBoolValueInput('refresh', 'Refresh', False, '') and then listening for the input changed event that's triggered when the user clicks the button.

 

The trouble is, "refresh" is shown both to the left of, and on, the button:

 

Screenshot 2024-01-27 at 1.58.17 AM.png

 

I think it would better if it were only shown on the button, and not as a field label to the left of the button. (This is doubly true if I need to use a longer caption, like "Reset to Defaults" or something.)

 

I can't figure out how to do that. Setting the name to the empty string, then setting the button text has no effect (the field label immediately adopts the same text):

 

 

refresh_button = command.commandInputs.addBoolValueInput('refresh', '', False, '')
refresh_button.text = 'Refresh'

 

 

Setting the button to full width works, but then it doesn't line up with the rest of the controls (presumably because it's trying to center it, but it doesn't look good):

 

 

refresh_button = command.commandItems.addBoolValueInput('refresh', 'Refresh', False, '')
refresh_button.isFullWidth = True

 

 

Screenshot 2024-01-27 at 2.03.05 AM.png

 

What else can I try?

 

Thanks!

0 Likes
428 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor

I agree there should be more control over how inputs are displayed in the dialog. I'm not sure what Fusion supports internally, which is a limiting factor to what the API can expose. Have you seen any Fusion commands that do this? 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 3 of 3

j4n.vokurka
Advocate
Advocate

Hello,

in current version of Fusion there is no way you can hide the text and keep the control centered. One possible option is to hide both labels and put a dummy item which will function as a placeholder into the dropdown. 

So instead of having "Part" label on the left you will have something like "Select part" item in the dropdown. You would have to handle the selection of items in inputChanged or/and in cmdExecuted but you could center both controls and avoid the label issue.

0 Likes