03-30-2017 08:04 AM
Hello everyone,
I am currently working on a project that involves reading information from a csv file, parsing it, and then displaying the information in a table. I have been able to complete all of that, but am a little stuck on the next step.
My goal is to allow a user to select specific column headers, and then have the information from that column stored in an array so I can perform calculations on the information.
Can anyone steer me in the proper direction on how to properly complete this task?
Thank you very much!
03-31-2017 03:10 AM - edited 03-31-2017 03:12 AM
You can install a callback on the table and trap EVENT_TABLE_ROW_COL_LABEL_CLICK event in that, next check eventData2 parameter that holds the column clicked (it is 0 if the user clicked a row header) and use GetTableCellRangeVals (panelHandle, PANEL_TABLE, VAL_TABLE_COLUMN_RANGE (eventData2), array); to get your data.
'array' must be an array of the correct data type and enough lenght to read the whole column.
VAL_TABLE_COLUMN_RANGE is a handy macro defined in userint.h, a file where you can find others as well.
03-31-2017 08:17 AM
Thanks Roberto, that seems to be the way to do it!
Do you know if it is possible to change the table label so that it contains the first row of my data?
Thanks a lot for the help, I really appreciate it!
03-31-2017 10:00 AM
I suggest you to look at the table control help (which you can reach in your PC by right clicking on the control and selecting "Control help" in the context menu): by looking at the control functions you'll find SetTableColumnAttribute which you can use to change the column header by using ATTR_LABEL_TEXT attribute.