Get the controls in a table row

Get the controls in a table row

ebunn3
Advocate Advocate
758 Views
3 Replies
Message 1 of 4

Get the controls in a table row

ebunn3
Advocate
Advocate

Hi,

 

I am using itemById to gain access to a table in my command dialog.  The table consists of many rows each containing 6 text box controls.  The text box control ids were created using a number system, for example: textbox00 which would be the first one in row 1.  Is there a way to access just the 6 text boxes on a row without know their names?  Can I gain access to the row and then iterate through the controls on that row?

 

ebunn3_0-1634141068871.png

 

 

Thanks,

 

Eric

0 Likes
Accepted solutions (1)
759 Views
3 Replies
Replies (3)
Message 2 of 4

BrianEkins
Mentor
Mentor
Accepted solution

You can use the TableCommandInput.getInputAtPosition method to get the input at a specified row and column.

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

ebunn3
Advocate
Advocate

Brian,

 

Thank you so much.  This will work perfectly.  This can be easily implemented into a nested loop.  

 

Eric

0 Likes
Message 4 of 4

ebunn3
Advocate
Advocate

For anyone else's benefit.  Here is the function I put together to update a table of text controls.

 

Eric

 

def updateTableText(inputs,id,textAdd):
    """pass in inputs, id of table, nested list of values
    structured to match rows and columns in table"""
    table = inputs.itemById(id)
    for i in range(0,table.rowCount):
        for j in range(0,table.numberOfColumns):
            ctrl = table.getInputAtPosition(i, j)
            ctrl.formattedText = '<div align="center", style="font-size:10px" , style="color:black" ><b>' + textAdd[i][j] + '</b></div>'

 

0 Likes