Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TDBGrid Column Widths do not always scale as expected



Permlink Replies: 2 - Last Post: Dec 31, 2017 1:16 AM Last Post By: Malcolm Taylor
Malcolm Taylor

Posts: 148
Registered: 7/16/01
TDBGrid Column Widths do not always scale as expected
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 28, 2017 9:40 AM
Tokyo Update 2 + 2004 patch.

I have been testing a 32-bit program on the latest Windows 10 release
(1709) for High_DPI scaling using a primary monitor at 100% and
secondary at 175%.

Launching on the primary renders all my DBGrids as designed, but when
dragged to the secondary some of the columns are scaled 'wider' than
expected. Then when dragged back to the primary those columns are not
scaled all the way back to their designed widths.

After my festive excesses it took me some time to spot the cause/bug.

Certain column width values are not displayed in bold in the Object
Inspector and those (default?) values are optimised out of the .dfm
file.
In these cases it seems that the HiDPI scaling code picks the 'wrong'
default values and, in my cases at least, increases the width too much
when scaling up.
Then when scaling back down to 100% it ends up still too large.

I found that simply incrementing or decrementing my desired column
width value was enough to 'defeat' the optimisation, write the value to
the .dfm, and result in correct scaling.

Is this a known issue? Can anyone else confirm this observation? I
have seen this happen with widths of 40 and 64 but have not tested more
widely. I have no idea how the IDE determines the defaults.

If I am not doing something wrong and others can see this, I will
report it in QP.

Malcolm
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: TDBGrid Column Widths do not always scale as expected
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 29, 2017 5:14 AM   in response to: Malcolm Taylor in response to: Malcolm Taylor
This is starting to show a similarity to RSP-18388 where the scaling
can be performed twice.

The DBGrid columns appear to have a default width at design time
related to the Title Caption and if the developer accepts or chooses
that value, the width is optimised out of the .dfm

When I adopt such as value (in my test case: 41) I find the following:

1. The column width property is omitted from the .dfm
2. Launching the program at 100% and reading the column width gives 41
3. Dragging to the 175% monitor and reading the column width gives 123
= a 300% increase! (1.75 * 1.75 is approx 3)
4. Dragging back to 100% monitor and reading the column width now
gives 70
5. Further dragging between the monitors flips between 70 and 123 =
(123 is approx 175% of 70)

So the problem is that the initial drag first scaled 41 * 1.75 to get
approx 70, then scaled 70 up to 123

All the columns with widths that were written to the .dfm were scaled
one time only.

Has to be a bug.
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: TDBGrid Column Widths do not always scale as expected
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 31, 2017 1:16 AM   in response to: Malcolm Taylor in response to: Malcolm Taylor
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02