02-11-2010 03:20 PM
I'm using a table in my application that is going to be populated at runtime. At design time the table is empty. I need the columns of the table to be different types (string, double, ring, etc.). I'm trying to find a way to define all this at design time (including defining the entires in the ring controls) so that at runtime I can just call InsertTableRows and all the cells are already setup correctly.
As far I can tell there's no way to set column defaults like type and ring control entries at design time. So I started by creating a single row at design time and setting it up the way I wanted, hoping that this essentially defined the defaults for every row. That didn't work. I also tried setting this stuff up at runtime during the init phase using SetTableColumnAttribute and InsertTableCellRingItem. SetTableColumnAttribute worked (although it's a pain to do this for every column), but InsertTableCellRingItem requires a cell location, which means that I would have to call it every time I create a new row instead of each new row inheriting the ring's properties.
Is what I'm trying to do even possible, or do I just have to clutter my code with a bunch of calls everytime I create a new row?
02-11-2010 04:53 PM
Not sure about ring cell entries, but setting cell defaults at design time is definitely posible. Normally I prepare all my tables this way:
- Create the table and set general default cell type before adding rows / columns to it
- Set table mode to column mode
- Progressively add needed columns and set default values / attributes for them
- Verify table resulting aspect by adding one or more rows and manually filling the cells
- Delete all rows
At runtime adding rows using VAL_USE_MASTER_CELL_TYPE constant as Cell type parameter in InsertTableRows creates rows with the appropriate (defaults) aspect and values.
02-12-2010 03:47 AM
OK, I wasn't able to check in an IDE when I answered yesterday, now I can add some more details on this.
The 'default cell values' button in table properties of the UIR editor actually permits to customize cell attributes (like type of data, font attributes, numeric cells data type, precision, range....), not their values: you are not able to set neither ring list values nor string/numeric default value (they defaults respectively to 0 and empty string). You will need to add these elements at runtime after creating a row.