From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-18-2014 08:47 AM - edited 12-18-2014 09:10 AM
With normal ring controls, each item has a uniqe index but is allowed to have any value you choose.
I am most disappointed to learn that ring-configured cells of a table don't have a value field! This is a shame, as it means I have to programmatically build my table ring cells in a special order. I effectively have to keep track of the order of the ring items in two spots. Here's why:
in my header, I have an enum list that represents the order of my ring cell:
enum { PGM_TYPE_NONE, PGM_TYPE_ABSPOS, PGM_TYPE_P1, PGM_TYPE_P2, PGM_TYPE_OFF_P2, PGM_TYPE_RELPOS, PGM_TYPE_NEEDLE, PGM_TYPE_MOTOR, PGM_TYPE_PUMP, PGM_TYPE_OFF_P1, };
Then I build the ring cell in code like this:
InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_NONE,PGM_TYPE_NAM_NONE); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_ABSPOS,PGM_TYPE_NAM_ABSPOS); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_P1,PGM_TYPE_NAM_P1); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_P2,PGM_TYPE_NAM_P2); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_OFF_P2,PGM_TYPE_NAM_OFF_P2); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_RELPOS,PGM_TYPE_NAM_RELPOS); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_NEEDLE,PGM_TYPE_NAM_NEEDLE); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_MOTOR,PGM_TYPE_NAM_MOTOR); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_PUMP,PGM_TYPE_NAM_PUMP); InsertTableCellRingItem(programTab,TABPROG_TABLE,MakePoint(COL_NUM_TYPE,row),PGM_TYPE_OFF_P1,PGM_TYPE_NAM_OFF_P1);
The order must be maintained in both places, or the ring cell won't get built. What's worse, this method isn't future proof. If I add more ring items, they are forced to go to the bottom of the list to maintain backwards compatibility. This sucks for sorting purposes.
Am I overlooking the value somehow?
12-19-2014 02:37 PM
Hi ElectroLund,
To clarify, are you trying to change the value of the index that is associated with the ring cell entry? If I understand your question correctly, I'm not sure there is a way to do this. If you wanted to change the order than each enum element is added to the ring cell, you could insert in the desired order with "-1" set as the index parameter to add immediately after the previous entry; the order of your insert statements would determine the overall order. Another option would be to create another enum/array with index values, and insert into the ring cell a pair of the element and index desired. Then, you might be able to update the index array separately.
Regards,
01-05-2015 08:23 AM
Kristen, you are right. I could use the "-1" to build the ring controls irrespective of the order. The problem with this solution, which I didn't mention above, is that elsewhere my software saves this table as a configuration to an INI file. So the order of the ring in the table is vital for backward compatibility.
Hence, when new items are added to the ring in the future, because values are not selectable, I am forced to add these new items to the bottom of the list.
In essence, what I'd like to be able to do is have the freedom to reorder the ring items how I want without changing the values. If would be great to have hardcoded values, but any order.
I don't think it's possible.