Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Trigger onExecutePreview with selection in TableCommandInput

Anonymous

Trigger onExecutePreview with selection in TableCommandInput

Anonymous
Not applicable

I am trying to have a list of strings be shown in a TableCommandInput, and whenever one of them is selected I would like to notify the onExecutePreview handler. Currently the TableCommandInput.selectedRow attribute will change, but that doesn't trigger the onExecutePreview handler. Is there some other way I should go about this? I tried using BoolValueInput instead of StringValueInput but the button is small and doesn't cover the full row.

0 Likes
Reply
Accepted solutions (1)
249 Views
1 Reply
Reply (1)

Anonymous
Not applicable
Accepted solution

I ended up figuring out how to resolve this. It turns out that InputChanged commands will trigger when a new row is selected, so I made a InputChangedHandler that will execute the preview if a new row is selected. The code is below. My table is set up so that each of the rows is a read only StringValueInput, with id being row[number].

 

class CommandInputChangedHandler(adsk.core.InputChangedEventHandler):
	def __init__(self):
		super().__init__()

	def notify(self, args):
		eventArgs = adsk.core.InputChangedEventArgs.cast(args)
        
		changedInput = eventArgs.input
		previousInputs = eventArgs.inputs

		if 'row' in changedInput.id:
			table = previousInputs.itemById('mainTable')
			_, newRow, _, _, _ = table.getPosition(changedInput)
			table.selectedRow = newRow

			command = eventArgs.firingEvent.sender
			command.doExecutePreview()
1 Like