If you search on AutoFit on your GBC project sources, you will find references to AutoFit in $GBC_PROJECT_DIR/src/js/base/widget/widgets/containers/responsive/RTableWidget.js and in particular a function autoFitAllColumns
With another customer with a similar request I investigated having a custom front-call (
http://4js.com/online_documentation/fjs-gbc-manual-html/#gbc-topics/c_gbc_frontcalls.html) calling that same function.
What we found was that we could add a 4gl button that would call that same functionality via the custom front-call. The customer ended up using this technique to add a button to Auto-Fit all the tables on a form with a single click rather than the user having to click in each table individually.
We tried calling this custom front-call in the BEFORE DISPLAY to do what you want, that is to autofit the table as it is loaded.
BEFORE DISPLAY
CALL custom front-call to trigger autofit
but what we found was that when being called at that point, the table had not been populated so there was no data to do the auto fit calculations! We could verify that hypothesis with something like ...
ON TIMER 1
IF first_time THEN
CALL custom front-call to trigger autofit
LET first_time = FALSE
END IF
and this would autofit the columns automatically as the data had been populated by the time the ON TIMER was triggered. However You don't want ON TIMER 1 in your code so this is not a viable solution. (In writing this I can't recall if we tried in BEFORE ROW)
There is an open enhancement in the system
https://4js.com/support/issue/?id=GBC-2345 to provide programmatic control of autoFitAllColumns, and fitToViewAllColumns. You could get your support contact to add you to the list of requestors to that.
There has also been consideration to move the storage of stored settings away from the client to the server., but that would be a major release enhancement if and that is a big if, if we went down that path, a lot of unanswered questions. (
https://4js.com/support/issue/?id=FGL-4536). Again get your support contact to add you to requesters for that enhancement if interested.
For your problem where the stored settings have been removed due to company policy, my thought is to investigate writing a custom front-call to read/write all or individual stored settings. At application end or press of a button read them and write them in your database, and at application start read them from a database and write to where the GBC stores them. With GDC in the past I used a front-call calling regedit to do something similar before UAC got in the way. So I would start by looking at GBC project sources, search on stored settings, note on how it is implemented, can I write a custom front-call to read/write that information? and store it elsewhere?
Reuben