command.isOKButtonVisible

command.isOKButtonVisible

brad.bylls
Collaborator Collaborator
545 Views
3 Replies
Message 1 of 4

command.isOKButtonVisible

brad.bylls
Collaborator
Collaborator

In my code I have this in my UI create method: command.isOKButtonVisible = False

This works because when the UI is created, the OK button is not visible.

Later in the code when the user has selected everything he/she is supposed to, I have: command.isOKButtonVisible = True

This however does not work.

I have checked to make sure it is run during debugging.

What am I missing?

Brad Bylls
0 Likes
Accepted solutions (1)
546 Views
3 Replies
Replies (3)
Message 2 of 4

kandennti
Mentor
Mentor

Hi @brad.bylls .

 

Perhaps the isOKButtonVisible property only works on the commandCreated event.


It would be easier for the user to understand if the OK button is grayed out until the conditions for executing the command are met, and then the OK button can be pressed when the conditions are met.


The state of the OK button can be changed using the validateInputs event and the areInputsValid property.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-48f1c5e6-9c63-4da4-b0eb-6701e8569013 

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-dcf60135-6fcf-4ca5-bd53-b9df4cbea341 

Message 3 of 4

brad.bylls
Collaborator
Collaborator

It is a matter of taste if the OK button is greyed out or not visible at all.

If I can change the visibility to False, it should also change to true the same way.

It seems that using the validatInputs event is a lot more unnecessary code if the OKButtonIsvisible would work.

And for my situation that would be just fine.

I will however explore your suggestion.

Thank you. 

Brad Bylls
0 Likes
Message 4 of 4

BrianEkins
Mentor
Mentor
Accepted solution

I would expect the same behavior as you about making the OK button visible, but I'm also not too surprised that it's not working.  The original use was to hide it for the dialog completely, so there was never a reason to make it visible again, and this workflow was likely never tested.  All of the built-in Fusion commands behave as Kandennti described, which is to show the OK button but have it disabled until the user has provided valid input.

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