When I start my prg I define my table col headers and widths. When I start saving data to the table and then make the table visiable to review the data everything is as I set it. When I exit prg I save table to csv file. Now when I start prg and load csv file the col headers are fine but the col widths are not what I programmed. They are to wide. When I load a csv file am I suppose to reformat the table?
If I correctly understand the behavior of tables: whenever you load a csv file into a table, the table contents (rows, columns) get wiped out and replaced by the contents of the file. Column widths will be reset back to the default value.
The solution would be to create a subroutine to handle the column widths. You can then call then routine at startup, and each time you load the file.
In my programs I save the column widths in a setup file with last values used, because the user can change the width. When he starts the program, the setup file is read and the column widths put in variables, so he will find the last values he set. After each load of a csv file you run Reset_ColWidth routine where you put the variables instead of the numeric values.
Why would user want or need to adjust colwidth from the running prg. Up until now I never thought about that. Could you give a simple senario where this would apply. I admire and respect your programming skills so I know there is a reason. :sign0188:
In the Expense tracker and Wine cellar manager programs the user can add new names with different lengths, depending on what the user wants to see or focus on, he can adjust the column width to his convenience. Of course if you have data with fixed length you won't need the adjustment.