View Issue Details

IDProjectCategoryView StatusLast Update
0038701PackagesPackagespublic2021-04-10 20:57
ReporterMartok Assigned ToMichl  
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Fixed in Version2.1 (SVN) 
Summary0038701: dockedformeditor: dimensions of form with menu are wrong
DescriptionA form with a MainMenu that is designed with dockedformeditor will be too small at runtime.
Conversely, a form designed without dockedformeditor will have the correct dimensions at runtime and be too tall when opened with dockedformeditor.

This does not occur without a MainMenu, looks like a Height/ClientHeight issue?

Also related to saving/loading: forms saved with dockedformeditor do not store the LCLVersion property (as if they were frames), which causes diff noise when moving between IDEs with and without dockedformeditor.
TagsNo tags attached.
Fixed in Revision64924
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0038702 closedMichl dockedformeditor: border at bottom-right gets added to form dimensions 

Activities

Michl

2021-04-04 12:24

developer   ~0130074

> A form with a MainMenu that is designed with dockedformeditor will be too small at runtime.
> Conversely, a form designed without dockedformeditor will have the correct dimensions at
> runtime and be too tall when opened with dockedformeditor.
>
> This does not occur without a MainMenu, looks like a Height/ClientHeight issue?

In most widgetsets (as I can see, all except qt4, qt5), the main menu isn't shown in a docked form. So main menu is emulated. The height is taken by widgetset, when possible. Maybe it is a Windows 8.1 issue. I'll see, if I can improve something here.

> Also related to saving/loading: forms saved with dockedformeditor do not store the LCLVersion
> property (as if they were frames), which causes diff noise when moving between IDEs with and
> without dockedformeditor.

This has nothing to do with this package. The saved properties also size of a form or frame should be the same, with/without DockedFormEditor. If not, then there is a issue like above or related issue on Windows 8.1

Martok

2021-04-04 21:07

reporter   ~0130086

> The height is taken by widgetset, when possible.
The height of the fake menu panel is correct, it just doesn't get taken into account later...
Try the attached demo project. The form is set (via object inspector) to 300x200, with a 50x50 shape at 250/150, so the bottom-right corner should be exactly matching.
The current dimensions(O=) and client-dimensions(C=) at start are displayed in FormCreate, click the form to update.
For me, it starts with Height=ClientHeight (which is wrong), and gets resized to 25px less, which is the menu bar height. The screenshot shows the state after clicking once.

The LCLVersion thing is because TForm.LCLVersionIsStored finds a Parent when it makes its decision which is technically true... Not really avoidable.
b0038701.zip (1,905 bytes)
scrn-menuform.png (6,341 bytes)   
scrn-menuform.png (6,341 bytes)   

Michl

2021-04-04 23:49

developer   ~0130090

I previously thought that the main menu is added to client area. I checked this before - but obviously I mixed this up. The bug of the height of main menu is fixed now in Trunk revision 64924.

> The LCLVersion thing is because TForm.LCLVersionIsStored finds a Parent
> when it makes its decision which is technically true... Not really avoidable.

Can you describe this more detailed - I don't get it. Maybe you can add a minimal example with a frame to make it more clear for me.

Martok

2021-04-05 01:31

reporter   ~0130097

> The bug of the height of main menu is fixed now in Trunk revision 64924.
Confirmed. Thanks!

In case you aren't aware yet: 64923 has a problem for the first PageControl in a SourceEditor (such as Project/New/Appplication), the SynEdit stays hidden. Fixes itself after opening a second code tab.

> Can you describe this more detailed - I don't get it.
I don't get it either ;-)
LCLVersion is stored based on TForm.LCLVersionIsStored, which checks for Parent<>nil. The Form being in the docked editor seems to count as a Parent so it never gets written from the docked editor, while it would be from the floating editor.
Doesn't make sense to me since the Designer should be aware that this is not a Parent in the same sense that i.e. a Component *on* a designed Form has a parent?

Martok

2021-04-05 22:02

reporter   ~0130117

Last edited: 2021-04-10 20:33

View 5 revisions

> Confirmed. Thanks!
Correction: Controls with Align=alClient now "overflow" to the bottom, but are correct at runtime. <strike>There is some point where the PanelFakeMenu.Height must be added, removed one too many apparently...</strike>

Edit: So, here's what happens.
(Outer) Height is the same regardless of a menu bar. This is currently correct.
The menu bar is part of the window area, but not part of the client area. In LCL terms, when a menu is added, Height remains constant but ClientHeight is reduced by the height of the menu. With floating windows, the menu is real and this is done by the native widgetset... no idea what to do about that. The designer should somehow tell the Form that it has an offset?
Edit2: On windows, this can be done by handling WM_NCCALCSIZE and shifting the client area rectangle down by the menu height if required. It's already subclassed, so that seems easy enough. Still leaves the other widgetsets...
Edit3: Joke's on me, L/WM_NCCALCSIZE isn't dispatched to forms at all. Works in Delphi, doesn't work in Lazarus. And would not be widgetset agnostic anyway.

Michl

2021-04-10 20:57

developer   ~0130247

Thank you for your suggestions and your invested time! I'm clear what happens. I'm currently working on this issue and test some possible solutions. Till now, I don't know, what is the best way to go, so maybe it will take a while. Please be patient and don't invest to much time here ;)

Issue History

Date Modified Username Field Change
2021-04-04 04:03 Martok New Issue
2021-04-04 12:24 Michl Assigned To => Michl
2021-04-04 12:24 Michl Status new => assigned
2021-04-04 12:24 Michl LazTarget => -
2021-04-04 12:24 Michl Note Added: 0130074
2021-04-04 12:24 Michl Relationship added related to 0038702
2021-04-04 21:07 Martok Note Added: 0130086
2021-04-04 21:07 Martok File Added: b0038701.zip
2021-04-04 21:07 Martok File Added: scrn-menuform.png
2021-04-04 23:41 Michl Build => 64924
2021-04-04 23:41 Michl Fixed in Version => 2.1 (SVN)
2021-04-04 23:41 Michl Widgetset Win32/Win64 => Win32/Win64
2021-04-04 23:41 Michl Build 64924 =>
2021-04-04 23:41 Michl Fixed in Revision => 64924
2021-04-04 23:41 Michl Widgetset Win32/Win64 => Win32/Win64
2021-04-04 23:49 Michl Status assigned => feedback
2021-04-04 23:49 Michl Note Added: 0130090
2021-04-05 01:31 Martok Note Added: 0130097
2021-04-05 01:31 Martok Status feedback => assigned
2021-04-05 22:02 Martok Note Added: 0130117
2021-04-06 23:41 Michl Status assigned => confirmed
2021-04-07 23:00 Martok Note Edited: 0130117 View Revisions
2021-04-07 23:05 Martok Note Edited: 0130117 View Revisions
2021-04-07 23:29 Martok Note Edited: 0130117 View Revisions
2021-04-10 20:33 Martok Note Edited: 0130117 View Revisions
2021-04-10 20:57 Michl Note Added: 0130247