Hi,
WinDev AAF offers to move, resize, hide and unhide colums of a Table. But there is no easy way to return to the original column configuration. The code below allows for being added to all Tables (with the name 'Table', others have to bee adapted) in the System popup-menu as a menu-item of something like 'Reset Column Configuration':
TC,TX, TW, TD are int
TN is string
TC = TableCount(Table,toColumn)
FOR TX = 1 TO TC
TN = TableEnumColumn(Table,TX)
TableMoveColumn(Table,TN,TX)
IF {"Table."+TN}..InitialVisible = True THEN
{"Table."+TN}..Visible = True
{"Table."+TN}..Width = {"Table."+TN}..InitialWidth
TW += {"Table."+TN}..Width
END
END
TD = Table..Width - TW - 18 // 18 ~= Width of vertical scrollbar of Table
FOR TX = 1 TO TC
TN = TableEnumColumn(Table,TX)
IF {"Table."+TN}..InitialVisible = True THEN
{"Table."+TN}..Width += TD * {"Table."+TN}..AnchorRateWidth / 1000
END
END
Note 1: I wasn't able to find the width of the vertical scrollbar of the table programmatically. Vertical scrollbars of my tables ('110 System') are 18 pixels in width ..
Note 2: to make the second part of the procedure work, take care that the original AnchorRateWidth of the visible colums add up to 100%
Note 3: In order to make this code even independent from the name of the Table ('Table') you'd have to experiment with
PopupField(..) to recover the name of the Table. However, I find it easier to change the Table's name in code ..
Kind regards,
Guenter
Edited 1 time(s). Last edit at 12/13/2009 06:13PM by Jimbo.