Hi, I don't understand what you want to achieve exactly but ... I have a global procedure which will sort
all visible columns to the original order and will put their width proportional to the original width in order to fill the table control. You need:
- in design state, the anchoring of all columns has to sum up to 100%
- in design state, all columns have to fill the table control
This procedure will work for any table control satisfying the conditions above. You just have to add a call to the procedure to the AAF-Menue of the table.
PROCEDURE ResetColumnConfiguration()
TC,TX, TW, TD are int
PopName is string = PopupField()
TN is string
TC = TableCount(PopName,toColumn)
FOR TX = 1 TO TC
TN = TableEnumColumn(PopName,TX)
TableMoveColumn(PopName,TN,TX)
IF {PopName+"."+TN,indControl}..InitialVisible = False THEN
{PopName+"."+TN,indControl}..Visible = False
ELSE
{PopName+"."+TN,indControl}..Visible = True
END
END
FOR TX = 1 TO TC
TN = TableEnumColumn(PopName,TX)
{PopName+"."+TN,indControl}..Width = {PopName+"."+TN,indControl}..InitialWidth
IF {PopName+"."+TN,indControl}..Visible = True THEN
TW += {PopName+"."+TN,indControl}..Width
END
END
TD = {PopName,indControl}..Width - TW - 18 // 18 ~= Width of vertical scrollbar of Table
FOR TX = 1 TO TC
TN = TableEnumColumn(PopName,TX)
{PopName+"."+TN,indControl}..Width += TD * {PopName+"."+TN,indControl}..AnchorRateWidth / 1000
END
TableDisplay(PopName,taInit)
RETURN
Kind regards,
Guenter Predl
office@windev.at