Dialog width

Dialog width

brad.bylls
Collaborator Collaborator
1,272 Views
9 Replies
Message 1 of 10

Dialog width

brad.bylls
Collaborator
Collaborator

Is it possible to set the width of a dialog box in an API script?

Brad Bylls
0 Likes
Accepted solutions (2)
1,273 Views
9 Replies
Replies (9)
Message 2 of 10

Jorge_Jaramillo
Collaborator
Collaborator
Accepted solution

@Jorge_Jaramillo - this post is being edited to remove PII.

 

Hi,

I believe that Command.setDialogInitialSize Method is what you're looking for: https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-06bcc33f-87df-4894-b184-1666838547fe.
You can use it to set the initial size of a command dialog.

Regards,
Jorge Jaramillo

Message 3 of 10

kandennti
Mentor
Mentor

Hi @brad.bylls -San.

 

I hadn't thought of this, but it certainly may not be configurable.

 

With Palette, it is possible to specify the width.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-5C4D3AFA-AF61-4536-90C4-B7B4EE6A0E2D 

0 Likes
Message 4 of 10

brad.bylls
Collaborator
Collaborator

Does this command only work once?

I used it and it set the width and height the first time.

However, I changed the width because it was too large, but nothing changed.

I tried several times to change the width but nothing changed.

Brad Bylls
0 Likes
Message 5 of 10

Jorge_Jaramillo
Collaborator
Collaborator

@Jorge_Jaramillo - this post is being edited to remove PII.

 

hi @brad.bylls ,

 

It depends where in your code you set its size.

Without knowing your code it is hard to solve the issue.

Could you share it?

 

Regards,

Jorge Jaramillo

 

Message 6 of 10

MichaelT_123
Advisor
Advisor

Hi Mr BradBylls,

 

The doc contains a little cryptic sentence:

 

Sets the initial size of the dialog when it is first displayed.

 

... which is perhaps responsible for what you are experiencing. On the bright side of things ... you are not the only One.

 

Regards

MichaelT

 

 

MichaelT
Message 7 of 10

brad.bylls
Collaborator
Collaborator
So if you don't know what size you need, too bad.
No good for me.
Thanks
Brad Bylls
0 Likes
Message 8 of 10

brad.bylls
Collaborator
Collaborator

See the attached.

Brad Bylls
0 Likes
Message 9 of 10

BrianEkins
Mentor
Mentor
Accepted solution

The behavior of this is a bit strange. When this part of the API was first implemented, we wanted to give full control over the size of the dialog but found out that wasn't supported by Fusion internals. Most dialogs don't have a defined size, and they share the latest dialog state. For example, if you run a command and then resize the dialog, then run another command, the new command will display using the new size. However, the user last modified the dialog becomes the new default for most commands. You can specify the initial size for commands where you want more control over the size. Fusion uses that when the dialog is first created, but it stores that size internally for the dialog and uses the stored size from then on. It does this because if the user modifies the dialog size, that becomes the new default size.

 

I still think it would be good to support a mode where you can define the dialog size and either not allow the user to change it or at least not save any modifications the user makes so it always goes back to the defined size. It's possible some internals have changes to make this a possibility, but I don't know.

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

brad.bylls
Collaborator
Collaborator

Thanks Brian.

My add-in has many different dialogs and most can use the same size.

But there are some that need a very wide dialog, and some only need a narrow one.

It would be nice if I could define the size for each dialog as needed.

At least then the user wouldn't have to keep changing them to suit.

 

Brad Bylls
0 Likes