[Lazarus] Request for Gitlab access rights for Cocoa

2021-09-28 Thread Alexey Tor. via lazarus

Hello. As you see on Gitlab comments:

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39372

Dmitry (Cocoa WS supporter) has no Gitlab rights and he wants to pass 
these rights to me - Gitlab account Alexey-T1. Please do so. Dmitry is 
busy and has no enough wish to talk here. But he continues his work in 
his public GitHUB fork.


--
Alexey

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] TStatusBar.AutoSize doesn't work (Lazarus 2.12, Win32)

2021-09-28 Thread Rolf Wetjen via lazarus

Hi everybody,

TStatusBar.AutoSize doesen't work. The size of the statusbar is always a 
default size.


From 
https://docs.microsoft.com/en-us/windows/win32/controls/status-bars#size-and-height 
:


"The height is based on the metrics of the font that is currently 
selected into the status bar's device context and on the width of the 
window's borders." LCL uses TWin32WidgetSet(WidgetSet).AppHandle to 
creates a dummy child window and calculates the statusbar height from 
this dummy window. There are three issues with this approach:


1. The font of the AppHandle window isn't the one LCL uses for the
   StatusBar object (StatusBar1.Font). So the calculated height doesn't
   fit for a large font.
2. AppHandle is not set if the statusbar parent form is created within
   a DLL (I'm using CreateNew for my deskband dll). Issue #37100.
3. The procedure InitializePreferredStatusBarHeight is called only once
   and will not recalculate on font changes.

The attached file win32wscomctrls.pp has two small changes to solve this:

InitializePreferredStatusBarHeight
Use Parent := GetDesktopWindow instead of 
TWin32WidgetSet(WidgetSet).AppHandle.
This is a wrong in the same way as TWin32WidgetSet(WidgetSet).AppHandle 
but should always work.


TWin32WSStatusBar.GetPreferredSize
Calculate the statusbar height from AWinControl.Font.Height on each 
call. Use InitializePreferredStatusBarHeight as a fallback and only once 
if needed.


Shall I open an issue for this?

Thank you for all comments.

Rolf

<>
<>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus