Reply
Highlighted
Explorer
10 Posts
1 Kudo
Accepted Solution

Question: How to add a listbox OR a drop-down list to a pre-existing window

49 Views, 3 Replies
a month ago

Hello, I wanted to know if it's possible and how to add either a listbox or a drop-down list to a pre-existing window.
Like, what I'm trying to do is that when a user click on a button on my GUI, it'll display a listbox or drop-down list, preferably in the same window as the button that was clicked. 

The image below is what I have right now, my GUI window and the listbox created using tkinter. I want it so that the listbox appears inside the GUI window.

Also, is there a way to organize the buttons such as instead of the buttons showing up in a vertical line, to organize them in a grid, like one button is in the top-left of the window, another button is to the right of that first one, a third button is below the first one, and a fourth button is below the second one and to the right of the third one.

 

fusion360 listbox.jpg

You should be able to create an empty drop-down list and even make it disabled so it would be visible but the user wouldn't be able to interact with it.  Once you know what needs to be in the list then you can populate the list and enable it so they can choose an item from the list.  You can use the disabled functionality for other inputs too so that only those that are relevant are enabled.  You can also make them invisible too, but I personally find it a little confusing when things appear and disappear and it's a little better when they're always there but just not available until it's appropriate.  But that's a design decision and Fusion supports both.

Autodesk Support
1262 Posts
353 Kudos
369 Solutions

Re: Question: How to add a listbox OR a drop-down list to a pre-existing window

a month ago in reply to: jmperez6

I'm not sure I fully understand what you want to do with a listbox or drop-down list.  You can define drop-downs in a Fusion command dialog by creating a DropDownCommandInput.  I guess what I don't understand is why you want to have them press a button to display the drop-down.  Why not have the drop-down always there and let them choose from the list?  However, it would be possible to have a button click result in the display of a drop-down.  When anything on a command dialog is interacted with by the end-user it results in the inputChanged event being fired along with information about which item in the dialog changed. The best approach would be to create the drop-down when the command is created but set it as invisible and then when the button is clicked you would make it visible.

 

Regarding organizing your dialog in a different way, you can use the TableCommandInput.  This is a table that contains other command inputs, so it lets you organize them in a row-column way.  You can read more about it here.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Explorer
10 Posts
1 Kudo

Re: Question: How to add a listbox OR a drop-down list to a pre-existing window

a month ago in reply to: ekinsb

The reason I want the drop-down/selection box to show up after they click on the button is, well I'll explain what i'm trying to do.

So the buttons in the GUI are placed in order. First, the user needs to click on the "Browse" button that will create a file dialog box to allow them to select a schematic file. Once they click on "OK" in that dialog box, a background script reads that chosen schematic file and parses it and creates a new text file with the parsed schematic file.

Then, they would need to click on the "Load" button, which will read the components described in the newly created text file and will create the drop-down list/selection box and fill it with the list of components. So I wouldn't be able to have a drop-down list already made since I don't know how many components there are in the file, or rather, I'm not sure if I can create an empty drop-down list and add the options later on.

 

But thank you, I will do that tableCommandInput you recommended.

Autodesk Support
1262 Posts
353 Kudos
369 Solutions

Re: Question: How to add a listbox OR a drop-down list to a pre-existing window

a month ago in reply to: jmperez6

You should be able to create an empty drop-down list and even make it disabled so it would be visible but the user wouldn't be able to interact with it.  Once you know what needs to be in the list then you can populate the list and enable it so they can choose an item from the list.  You can use the disabled functionality for other inputs too so that only those that are relevant are enabled.  You can also make them invisible too, but I personally find it a little confusing when things appear and disappear and it's a little better when they're always there but just not available until it's appropriate.  But that's a design decision and Fusion supports both.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog