<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Placing sliders inside a table in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/placing-sliders-inside-a-table/m-p/9333625#M12634</link>
    <description>&lt;P&gt;Ok, trying to answer my own question here. It seems this had something to do with the order in which command inputs are added to the table, changing the order in which these are added changes how my table renders. I thought that making sure all elements are added in order starting from row 0, cell 0 would fix the issue but this is not the case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I can't find any documentation stating what the last two parameters in table.addCommandinput do, as per my code it looks like it is (element,row #, column #, ????, ????) :&lt;/P&gt;&lt;PRE&gt;table.addCommandInput(ImageInput, 0, 0, 0, 0) #row, column, ??, ??&lt;/PRE&gt;&lt;P&gt;The sample code seems to add elements to the table one row at a time, I'll try this next to see if it helps.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Feb 2020 14:54:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-02-21T14:54:11Z</dc:date>
    <item>
      <title>Placing sliders inside a table</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/placing-sliders-inside-a-table/m-p/9331330#M12633</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm just getting started with the API and I'm trying to mock up a visual of what I would like my add-in to look like. For a particular piece of user feedback I would like to display several sliders inside a table, this would allow me to add other text/information in cells to the left and right of the slider, on the same row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try and use table.addCommandInput to place a slider inside a table cell it often display's below the table instead. Doing this also breaks the row order for the table. Sample code and screenshot are below, the example table I am referring to is the last one at the bottom of the dialogue box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas as to what is causing this would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table.JPG" style="width: 729px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/732238i0F18BF757A8AC52B/image-size/large?v=v2&amp;amp;px=999" role="button" title="table.JPG" alt="table.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import adsk.core, adsk.fusion, adsk.cam, traceback

_app = adsk.core.Application.cast(None)
_ui = adsk.core.UserInterface.cast(None)
_handlers = []


# Event handler for the execute event.
class MyExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        try:
            _ui.messageBox('Command executed.')
        except:
            if _ui:
                _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


# Event handler for the destroy event.
class MyDestroyHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        adsk.terminate()
        

# Event handler for the commandCreated event.
class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        try:
            eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
            inputs = adsk.core.CommandInputs.cast(eventArgs.command.commandInputs)
    
            # Create the table.
            tableCount = 0
            textBoxCount = 0
                       
            

            table = adsk.core.TableCommandInput.cast(inputs.addTableCommandInput('table' + str(tableCount), 'Inputs', 2, '1:1'))
            table.minimumVisibleRows = 3
            table.maximumVisibleRows = 3
            table.columnSpacing = 1
            table.rowSpacing = 1
            table.tablePresentationStyle = adsk.core.TablePresentationStyles.itemBorderTablePresentationStyle
            table.hasGrid = False                    
            tableCount += 1

            # Create a selection command input and add it to the table.
            for j in range(3):
                text = inputs.addStringValueInput('texta' + str(textBoxCount), 'Text ' + str(textBoxCount), 'Text ' + str(textBoxCount))
                text.isReadOnly = True
                table.addCommandInput(text, j, 0, False, False)

                text = inputs.addStringValueInput('textb' + str(textBoxCount), 'Text ' + str(textBoxCount), 'Some more text ' + str(textBoxCount))
                text.isReadOnly = True
                table.addCommandInput(text, j, 1, False, False)
                textBoxCount += 1

            table = adsk.core.TableCommandInput.cast(inputs.addTableCommandInput('table' + str(tableCount), 'Inputs', 2, '1:1'))
            table.minimumVisibleRows = 3
            table.maximumVisibleRows = 3
            table.columnSpacing = 1
            table.rowSpacing = 1
            table.tablePresentationStyle = adsk.core.TablePresentationStyles.transparentBackgroundTablePresentationStyle
            table.hasGrid = False                    
            tableCount += 1

            # Create a selection command input and add it to the table.
            for j in range(3):
                text = inputs.addStringValueInput('texta' + str(textBoxCount), 'Text ' + str(textBoxCount), 'Text ' + str(textBoxCount))
                text.isReadOnly = True
                table.addCommandInput(text, j, 0, False, False)

                text = inputs.addStringValueInput('textb' + str(textBoxCount), 'Text ' + str(textBoxCount), 'Some more text ' + str(textBoxCount))
                text.isReadOnly = True
                table.addCommandInput(text, j, 1, False, False)
                textBoxCount += 1
            
            table = adsk.core.TableCommandInput.cast(inputs.addTableCommandInput('table' + str(tableCount), 'Inputs', 3, '1:1:1')) #1:1:1 parameter controls the number of columns, '3' is number of columns but doesn't seem to do anything'
            table.minimumVisibleRows = 3
            table.maximumVisibleRows = 3
            table.columnSpacing = 1
            table.rowSpacing = 1
            table.tablePresentationStyle = adsk.core.TablePresentationStyles.itemBorderTablePresentationStyle
            table.hasGrid = False                    
            tableCount += 1

            stringInput = inputs.addStringValueInput('string1', '', 'Entry 1')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 0, 0, 0, 0)

            stringInput = inputs.addStringValueInput('string1', '', 'Entry 2')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 1, 1, 0, 0)

            stringInput = inputs.addStringValueInput('string1', '', 'Entry 3')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 2, 2, 0, 0)

            stringInput = inputs.addStringValueInput('string1', '', '&amp;lt;div align="center"&amp;gt;Entry 4&amp;lt;/div&amp;gt;')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 0, 2, 0, 0) #row, column, ??, ??

            table = adsk.core.TableCommandInput.cast(inputs.addTableCommandInput('table' + str(tableCount), 'Inputs', 1, '1')) 
            table.minimumVisibleRows = 1
            table.maximumVisibleRows = 1
            table.columnSpacing = 1
            table.rowSpacing = 10
            table.tablePresentationStyle = adsk.core.TablePresentationStyles.itemBorderTablePresentationStyle
            table.hasGrid = False                    
            tableCount += 1
            
            textboxInput = inputs.addTextBoxCommandInput('readonly_textBox', 'Text Box 1', '&amp;lt;div align="center"&amp;gt;This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. &amp;lt;/div&amp;gt;', 2, True)
            textboxInput.isReadOnly = True
            textboxInput.numRows = 6
            table.addCommandInput(textboxInput, 0, 0, 0, 0) #row, column, ??, ??

            #only known way to centre text inside a table looks to be to create a centered text box and then put this inside the table

            table = adsk.core.TableCommandInput.cast(inputs.addTableCommandInput('table' + str(tableCount), 'Inputs', 1, '1')) 
            table.minimumVisibleRows = 3
            table.maximumVisibleRows = 3
            table.columnSpacing = 1
            table.rowSpacing = 20
            table.tablePresentationStyle = adsk.core.TablePresentationStyles.itemBorderTablePresentationStyle
            table.hasGrid = False                    
            tableCount += 1
            
            ImageInput = inputs.addImageCommandInput('image', 'Image', "resources/image.png")
            ImageInput.isReadOnly = True
            table.addCommandInput(ImageInput, 0, 0, 0, 0) #row, column, ??, ??

            textlineInput = inputs.addTextBoxCommandInput('readonly_textBox', '', 'This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. This is an example of a read-only text box. ', 2, True)
            textlineInput.numRows = 6

            

            table = adsk.core.TableCommandInput.cast(inputs.addTableCommandInput('table' + str(tableCount), 'Inputs', 4, '1:2:1:1')) #1:1:1 parameter controls the number of columns, '3' is number of columns but doesn't seem to do anything'
            table.minimumVisibleRows = 3
            table.maximumVisibleRows = 10
            table.columnSpacing = 1
            table.rowSpacing = 1
            table.tablePresentationStyle = adsk.core.TablePresentationStyles.itemBorderTablePresentationStyle
            table.hasGrid = False                    
            tableCount += 1

            sliderinput = inputs.addIntegerSliderCommandInput('intSlider', 'Integer Slider', 0, 100)
            sliderinput.valueOne = 66
            sliderinput.isEnabled = False
            sliderinput.isFullWidth = False
            table.addCommandInput(sliderinput, 0, 1, 0, 0)
            #table.addCommandInput(sliderinput, 1, 1, 0, 0)

            sliderinput3 = inputs.addIntegerSliderCommandInput('intSlider3', 'Integer Slider3', 0, 100)
            sliderinput3.valueOne = 99
            sliderinput3.isEnabled = False
            sliderinput3.isFullWidth = False
            table.addCommandInput(sliderinput, 1, 1, 0, 0)

            #sliderinput2 = inputs.addFloatSliderCommandInput('floatSlider', 'Float Slider', 'percent', 0, 100.0, False)
            #sliderinput2.valueOne = 66.6
            #sliderinput2.isEnabled = False
            #table.addCommandInput(sliderinput2, 1, 1, 0, 0)

            stringInput = inputs.addStringValueInput('string8', '', 'Name 8')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 1, 0, 0, 0)

            stringInput = inputs.addStringValueInput('string9', '', 'Name 9')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 1, 2, 0, 0)

            stringInput = inputs.addStringValueInput('string10', '', 'Name 10')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 1, 3, 0, 0)

            stringInput = inputs.addStringValueInput('string1', '', 'Name 1')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 0, 0, 0, 0)

            stringInput = inputs.addStringValueInput('string2', '', 'Name 2')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 0, 2, 0, 0)

            stringInput = inputs.addStringValueInput('string3', '', 'Name 3')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 0, 3, 0, 0) #row, column, ??, ??

            stringInput = inputs.addStringValueInput('string4', '', 'Name 4')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 3, 0, 0, 0) #row, column, ??, ??

            stringInput = inputs.addStringValueInput('string5', '', 'Name 5')
            stringInput.isReadOnly = True
            table.addCommandInput(stringInput, 3, 1, 0, 0) #row, column, ??, ??

            

            #message = '&amp;lt;div align="center"&amp;gt;A "full width" message using &amp;lt;a href="http:fusion360.autodesk.com"&amp;gt;html.&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;'
            #tab1ChildInputs.addTextBoxCommandInput('fullWidth_textBox', '', message, 1, True) 

        
            # Connect to command execute.
            onExecute = MyExecuteHandler()
            eventArgs.command.execute.add(onExecute)
            _handlers.append(onExecute)
            
            # Connect to the command terminate.
            onDestroy = MyDestroyHandler()
            eventArgs.command.destroy.add(onDestroy)
            _handlers.append(onDestroy)            
        except:
            if _ui:
                _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
        

def run(context):
    try:
        global _app, _ui
        _app = adsk.core.Application.get()
        _ui  = _app.userInterface
        
        # Create a command.
        cmd = _ui.commandDefinitions.itemById('tableTest')
        if cmd:
            cmd.deleteMe()
            
        cmd = _ui.commandDefinitions.addButtonDefinition('tableTest', 'Table Test', 'Table Test', '')
        
        # Connect to the command create event.
        onCommandCreated = MyCommandCreatedHandler()
        cmd.commandCreated.add(onCommandCreated)
        _handlers.append(onCommandCreated)
        
        # Execute the command.
        cmd.execute()
        
        # Set this so the script continues to run.
        adsk.autoTerminate(False)

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 &lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Feb 2020 16:37:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/placing-sliders-inside-a-table/m-p/9331330#M12633</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-20T16:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Placing sliders inside a table</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/placing-sliders-inside-a-table/m-p/9333625#M12634</link>
      <description>&lt;P&gt;Ok, trying to answer my own question here. It seems this had something to do with the order in which command inputs are added to the table, changing the order in which these are added changes how my table renders. I thought that making sure all elements are added in order starting from row 0, cell 0 would fix the issue but this is not the case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I can't find any documentation stating what the last two parameters in table.addCommandinput do, as per my code it looks like it is (element,row #, column #, ????, ????) :&lt;/P&gt;&lt;PRE&gt;table.addCommandInput(ImageInput, 0, 0, 0, 0) #row, column, ??, ??&lt;/PRE&gt;&lt;P&gt;The sample code seems to add elements to the table one row at a time, I'll try this next to see if it helps.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 14:54:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/placing-sliders-inside-a-table/m-p/9333625#M12634</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-21T14:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Placing sliders inside a table</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/placing-sliders-inside-a-table/m-p/9352204#M12635</link>
      <description>&lt;P&gt;So adding all elements of the table in order and using the following method of adding the command input:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;table.addCommandInput(ImageInput, 0, 0, False, False)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;has resolved the issue. At present I'm not sure why this has worked, but it has...&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 10:01:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/placing-sliders-inside-a-table/m-p/9352204#M12635</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-02T10:01:55Z</dc:date>
    </item>
  </channel>
</rss>

