Global Settings: Go to Global Properties in your Clarion app and
check Enable Auto Size BrowseBox Columns. By default, this lets
users double-click the right border of any column header at
runtime to fit the contents.
Nice feature:
Is there a way to automatically adjust all columns?
! Public Methods
ResizeAll PROCEDURE
ResizeAll PROCEDURE(SIGNED ListControl)
So something like BRW1::AutoSizeColumn.ResizeAll somewhere towards the end of ThisWindow.Init() might work.
Have a look in the procedure’s ThisWindow.Init embed to see if you have something like BRW1::AutoSizeColumn.Init() present, if you have the ResizeAll above might work.
TLDR; Its “controlled” by the Browse template, in one of the property tabs iirc but shouldnt be changed.
Its basically BRW[%ActiveTemplateInstance] which is why they dont always run consecutively eg 1, 2, 3 for each Browse box because other templates which use %ActiveTemplates could be added in between.
So No it shouldnt be changed because its using %ActiveTemplateInstance to get its number and tie up other templates which use %ActiveTemplates
I changed your Title ending “Auto-Sizing” to end “Auto-Size All Columns” if that’s ok?
I would put the code near the end of the Event:OpenWindow embed. That way the Window is visible incase it takes some time on a slow network.
Rather than calling .ResizeAll() you could have a Loop like below that only Auto Sizes columns that should need it, like String Columns with size >= @s10.
STRING('Resizing All Columns ... Please Wait'),AT(),USE(?AutoSizeNotice),FONT(,,Color:Blue),COLOR(Color:White),HIDE
AutoSizeColumns ROUTINE
DATA
ListFEQ LONG
ColNo LONG
ColPic STRING(16)
CODE
UNHIDE(?AutoSizeNotice) ; SETCURSOR(Cursor:Wait)
ListFEQ = ?Browse:1
LOOP ColNo=1 TO ListFEQ{PROPLIST:Exists, 0} - 1 !No need last column
IF ListFEQ{PROPLIST:Width,ColNo} <= 0 THEN CYCLE. !Hide Column is Zero Wide
IF ~ListFEQ{PROPLIST:Resize, ColNo} THEN CYCLE. !Not Resizable (still can do if you want)
ColPic = UPPER(ListFEQ{PROPLIST:Picture, ColNo})
CASE SUB(ColPic,1,1)
OF ' ' !No @ @ Picture is unlimited String > @s255
OF 'S' !@s string type
IF SUB(ColPic,2,3) <= 9 THEN
CYCLE ! <= @s9 assume sized right, some kind of Code
END
OF 'P'
CYCLE !An @P P what to do? Assume sized right in design.
ELSE
CYCLE !@Num @Date @Time should be sized right so skip
END
BRW1::AutoSizeColumn.ResizeColumn(ListFEQ,ColNo)
END
HIDE(?AutoSizeNotice) SETCURSOR()
In case it takes some time I would unhide a little String like ?AutoSizeNotice. I skip the Last Column as there is no point. Only @S gets Auto Size if > @s9 figuring small text is size right. I normally get Numbers, Date and Time the exact size I want in the design. Just some ideas…
To get your Window Design sizes good you can use the Window Previewer. Adding my Window Previewer Class makes it easier. All you need to do is drop the LibSrc files from my Repo in your \Accessory\LibSrc and then Previews get the features.