Button row command input disabled but items enabled at start

Button row command input disabled but items enabled at start

marcinszydlowski.1984
Enthusiast Enthusiast
996 Views
4 Replies
Message 1 of 5

Button row command input disabled but items enabled at start

marcinszydlowski.1984
Enthusiast
Enthusiast

Hello,

 

I have a problem with setting ButtonRowCommandInput as fully disabled at the first time, I mean right after all controls are prepared and ready. Control seems to be disabled but its items not (user can interact with them):

 

Screenshot_1.png

There's no matter that multiselect is on or off in the control - it's items are always enabled. Disabling works when it is triggered once again by other control in. I've also checked the example available here: https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-e5c4dbe8-ee48-11e4-9823-f8b156d7cd97

 

Modification of the script (buttonRowInput2.isEnabled = False) didn't help:

...
# Create multi selectable button row input.
buttonRowInput2 = tab1ChildInputs.addButtonRowCommandInput('buttonRow2', 'Multi-select Buttons', True)
buttonRowInput2.isEnabled = False
buttonRowInput2.listItems.add('Item 1', False, 'resources/One')
buttonRowInput2.listItems.add('Item 2', False, 'resources/Two')
...

Is disabling of row button possible at start or the only way is to hide it if necessary?

0 Likes
Accepted solutions (1)
997 Views
4 Replies
Replies (4)
Message 2 of 5

kandennti
Mentor
Mentor

Hi @marcinszydlowski.1984 .

 

I tried it but could not reproduce it.

1.png

・ Fusion360 Ver2.0.8176
・ Win10 64bit
・ Ms-python_2020.4.76186
"ms-python" was updated with this method.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/vs-code-upgrade-to-the-latest-python-exten... 

0 Likes
Message 3 of 5

marcinszydlowski.1984
Enthusiast
Enthusiast

Hi @kandennti 

 

thank you for the quick answer but deleting vs-packages as mentioned in the post you've linked doesn't help. I use the newest version of Fusion (monthly subscription) and I'm working on Win8.1 Pro. I don't use vscode.

Maybe I should describe the problem in more details. My goal is to disable button row command input as default when controls are created - line 206 in the script. Now I cannot achieve this - text looks like the control is disabled but items (buttons "1" and "2" are still clickable). When I run the plugin it looks like this:

 

Screenshot_2.png

Later, when I use some logic to enable/disable this control (line 65 - triggered by clicking first bulb "Click button") everything works : both text and its items are turned off. Script with all resources are in attached zip.

 

0 Likes
Message 4 of 5

kandennti
Mentor
Mentor
Accepted solution

I'm sorry, I was mistaken for the isVisible property.

 

I thought that setting it with CommandCreatedEvent was the cause, so I tried the following.

class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            ・・・・
            # Connect to the input changed event.
            onInputChanged = MyCommandInputChangedHandler()
            cmd.inputChanged.add(onInputChanged)
            _handlers.append(onInputChanged)

            onActivate = MyActivateHandler()
            cmd.activate.add(onActivate)
            _handlers.append(onActivate)

            # Get the CommandInputs collection associated with the command.
            inputs = cmd.commandInputs
            ・・・・
            # Create single selectable button row input.
            global buttonRowInput
            buttonRowInput = tab1ChildInputs.addButtonRowCommandInput('buttonRow', 'Single Select Buttons', True)
            buttonRowInput.listItems.add('Item 1', False, 'resources/One')
            buttonRowInput.listItems.add('Item 2', False, 'resources/Two')
            # buttonRowInput.isEnabled = False
            ・・・・


# Event handler for the activate event.
class MyActivateHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        global buttonRowInput
        buttonRowInput.isEnabled = not buttonRowInput.isEnabled

I set it in the CommandActivate event, but the result was the same.

 

Also, I forcibly generated the event, but the result was the same here.

class MyActivateHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        global clkButton
        clkButton.value = not clkButton.value

I have no more ideas.
I'm sorry I can't help you.

0 Likes
Message 5 of 5

marcinszydlowski.1984
Enthusiast
Enthusiast

Ok. It seems that currently the only way is to hide/show this type of control if necessary. Thank you for check this.

0 Likes