Table Window: Font Change: How to prevent window size change ?

General discussion forum about all things Team Developer 5.x
Charlie
Canada
Posts: 47
Joined: 07 Mar 2017, 18:52
Location: Fredericton, New Brunswick, Canada

Table Window: Font Change: How to prevent window size change ?

Post by Charlie » 08 Sep 2017, 13:26

Over twenty years working with Team Developer, and I've never played around with fonts until recently. I guess that makes me a late-blooming fonts monkey...

I'm not particularly fond of on-the-fly font change (in a running app) causing a table window, and columns, to change size.

Is there a way to force the window and the columns to maintain their original sizes ?
A little trick to help direct folk from old Gupta forum to this one: Link to post

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 261
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Table Window: Font Change: How to prevent window size change ?

Post by Dave Rabelink » 22 Sep 2017, 06:17

Fonts and sizes of GUI's are interrelated. Though it has its drawbacks, it is a positive thing this relationship exists.
Form units of top level windows (forms/dialogs) are dependent on the used font. Or better said, it is related to the font metrics (overall width and height of the font).

The relationship is such that when the text displayed in a particular font type and size is fitting in a GUI object (like a button or datafield), it will be still fully displayed when the font metrics change.
This is done automaticaly by resizing the GUI object.

You can take advantage of this to create different GUI sizes for different resolutions. Just by changing the font on top level windows, the complete GUI is resized accordingly so that all texts keep fitting.
The complete form is resized.

You can also implement it such that a form does not change it's size, but the GUI objects do get resized. In that case, keep the form font settings the same and change the fonts of the child objects.
But that can lead into issues that child objects do not fit the form anymore.

Problem with child tables is that the columns and row heights are resized according to the font used. Changing the font changes the table size and the column/row sizes.
You are unable to set a different font without rows being automatically resized in height.

The only size you can programatically change is the column width. So, when you really need this, you can program that when you change the font of the table, first loop through all columns and get the widths.
THen set the font and then loop through the columns again to set the width back to the original size. But this might end up in texts not fitting anymore in the cells.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Charlie
Canada
Posts: 47
Joined: 07 Mar 2017, 18:52
Location: Fredericton, New Brunswick, Canada

Re: Table Window: Font Change: How to prevent window size change ?

Post by Charlie » 22 Sep 2017, 10:41

Thanks, Dave!

I must let it all percolate in me old sponge for a stretch.

For now, I've given users a small selection of font choices that work fine applied to child objects on forms.

I'm thinking I'll resize table windows back to original size after applying fonts.

Eventually, I'll allow "custom" choices for fonts, and in those cases apply those custom fonts to the windows and allow all objects concerned to resize themselves accordingly.

Something like that. Time for coffee...
A little trick to help direct folk from old Gupta forum to this one: Link to post

Return to “General Discussion”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests