View Issue Details

IDProjectCategoryView StatusLast Update
0031806LazarusLCLpublic2017-05-14 15:18
Reporterbald zhang Assigned ToOndrej Pokorny  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformwin32OSWindows 
Product Version1.9 (SVN) 
Summary0031806: high dpi: grid column width become 0 when equal DefautColWidth
Description4k dislplay, DPI = 192 (200%)

add columns to a grid, while column's Width = grid.DefaultColWidth,
it will becom 0 when running.

it has the same issue on a form or a frame.
TagsNo tags attached.
Fixed in Revision54895, 54903
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

bald zhang

2017-05-13 03:07

reporter  

grid-column-width-bad.png (26,393 bytes)   
grid-column-width-bad.png (26,393 bytes)   

bald zhang

2017-05-13 03:07

reporter  

grid-column-width-ok.png (27,508 bytes)   
grid-column-width-ok.png (27,508 bytes)   

bald zhang

2017-05-13 03:09

reporter  

grid_col_width_error.zip (259,795 bytes)

Ondrej Pokorny

2017-05-13 12:27

developer   ~0100282

This is a wanted and documented breaking change: http://wiki.freepascal.org/Lazarus_1.8.0_release_notes#Several_autosized_properties_changed_the_default_value_to_0

Use GetRealDefaultColWidth to retrieve the real (actual) width.

Ondrej Pokorny

2017-05-13 13:00

developer   ~0100284

Sorry, you were right. The TGridColumn.Width must return a valid value. Thanks for reporting. Fixed.

bald zhang

2017-05-13 20:11

reporter   ~0100285

tested r54897, it's not completely fixed.
Columns[1].Width was set to 128 to found that Width = DefaultColWidth has problem.
before this revision, Columns[1] was scaled properly, after, it has the same Width with Columns[0], not scaled.

Ondrej Pokorny

2017-05-13 21:28

developer   ~0100286

Can you please describe better what you mean?

If I set 150% scaling in Windows, I get correctly scaled Columns[1].Width=192. Both designtime and runtime.

bald zhang

2017-05-14 01:49

reporter   ~0100291

in Form1 & Frame1:
grid has two columns, [0].Width is 64, [1].Width is 128.
and grid.DefaultColWidth is 64, then I found the problem that [0].Width set to 0.

after this be fixed, [0].Width is 128, that's correct; but [1].Width still keep 128, and I think it should be 256 because my 200% DPI setting.

designtime and runtime has the same issue. I didn't do any desining in trunk version, just load project, compile and run.

and just do some futher test: change [1].Width to 100 then I got 200, yes - is scaled right, but change back to 128, it still not scaled.

maybe just because: 128 / 64 = 200% ???

Ondrej Pokorny

2017-05-14 09:07

developer   ~0100293

Yes, there was a problem I could spot only with 200%. When I tested with 150% it worked fine. Fixed.

bald zhang

2017-05-14 15:18

reporter   ~0100303

it's ok now

Issue History

Date Modified Username Field Change
2017-05-13 03:07 bald zhang New Issue
2017-05-13 03:07 bald zhang File Added: grid-column-width-bad.png
2017-05-13 03:07 bald zhang File Added: grid-column-width-ok.png
2017-05-13 03:09 bald zhang File Added: grid_col_width_error.zip
2017-05-13 12:27 Ondrej Pokorny Assigned To => Ondrej Pokorny
2017-05-13 12:27 Ondrej Pokorny Status new => assigned
2017-05-13 12:27 Ondrej Pokorny Note Added: 0100282
2017-05-13 13:00 Ondrej Pokorny Fixed in Revision => 54895
2017-05-13 13:00 Ondrej Pokorny LazTarget => -
2017-05-13 13:00 Ondrej Pokorny Note Added: 0100284
2017-05-13 13:00 Ondrej Pokorny Status assigned => resolved
2017-05-13 13:00 Ondrej Pokorny Resolution open => fixed
2017-05-13 20:11 bald zhang Note Added: 0100285
2017-05-13 21:28 Ondrej Pokorny Note Added: 0100286
2017-05-14 01:49 bald zhang Note Added: 0100291
2017-05-14 09:07 Ondrej Pokorny Fixed in Revision 54895 => 54895, 54903
2017-05-14 09:07 Ondrej Pokorny Note Added: 0100293
2017-05-14 15:18 bald zhang Note Added: 0100303
2017-05-14 15:18 bald zhang Status resolved => closed