Recent

Author Topic: Resizing in win32  (Read 3451 times)

big_M

  • Jr. Member
  • **
  • Posts: 95
Resizing in win32
« on: February 15, 2023, 03:23:16 pm »
When I resize a form in qt5/gtk2 the onresize event gets triggered constantly as soon as I start resizing a window, but not so in win32 where it only fires after the resizing is done.

Is there any way to change this?

balazsszekely

  • Guest
Re: Resizing in win32
« Reply #1 on: February 15, 2023, 03:33:42 pm »
When I resize a form in qt5/gtk2 the onresize event gets triggered constantly as soon as I start resizing a window, but not so in win32 where it only fires after the resizing is done.

Is there any way to change this?
In win32 you have to catch the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages.

big_M

  • Jr. Member
  • **
  • Posts: 95
Re: Resizing in win32
« Reply #2 on: February 15, 2023, 03:49:01 pm »
Oh, I see. Thx!

nanobit

  • Full Member
  • ***
  • Posts: 164
Re: Resizing in win32
« Reply #3 on: February 15, 2023, 03:50:12 pm »
but not so in win32 where it only fires after the resizing is done.

You use a Lazarus version which does not work.
Older versions (like my 2.0.x and older) and possibly the latest version fire onResize like you want.

big_M

  • Jr. Member
  • **
  • Posts: 95
Re: Resizing in win32
« Reply #4 on: February 16, 2023, 10:56:51 am »
In win32 you have to catch the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages.

Hm, I must admit this is currently a bit beyond my abilities. I have no clue about messages.

You use a Lazarus version which does not work.
Older versions (like my 2.0.x and older) and possibly the latest version fire onResize like you want.

Interessting. Is this a known behaviour/bug? I tried 2.2.2 and 2.2.4 on two different machines with Windows 10, they both behave the same

balazsszekely

  • Guest
Re: Resizing in win32
« Reply #5 on: February 16, 2023, 10:59:51 am »
Quote from: big_M
Hm, I must admit this is currently a bit beyond my abilities. I have no clue about messages.
https://forum.lazarus.freepascal.org/index.php/topic,41843.msg291170.html#msg291170

nanobit

  • Full Member
  • ***
  • Posts: 164
Re: Resizing in win32
« Reply #6 on: February 16, 2023, 12:04:08 pm »
Is this a known behaviour/bug? I tried 2.2.2 and 2.2.4 on two different machines with Windows 10, they both behave the same

I use only the older LCL which has a simpler concept.
For all newer versions there is a report. It may help you to continue, but this change has also some sideeffects (on operations which utilize the non-message queues (threadQueue, asyncCall)).

big_M

  • Jr. Member
  • **
  • Posts: 95
Re: Resizing in win32
« Reply #7 on: February 16, 2023, 01:06:26 pm »
https://forum.lazarus.freepascal.org/index.php/topic,41843.msg291170.html#msg291170

Thank you for the example, I will give it a try.

I use only the older LCL which has a simpler concept.
For all newer versions there is a report. It may help you to continue, but this change has also some sideeffects (on operations which utilize the non-message queues (threadQueue, asyncCall)).

That's good to know. I always use OnResize to update while dragging, eventhough that seems to be suboptimal. Let's see, I'm curious to see the difference. At least OnResize is system agnostic.

Btw, are there similar messages on linux? Because qt5 scales without flicker with OnResize, but gtk2 is not great...
« Last Edit: February 16, 2023, 01:52:59 pm by big_M »

big_M

  • Jr. Member
  • **
  • Posts: 95
Re: Resizing in win32
« Reply #8 on: February 16, 2023, 01:48:08 pm »
Ok, so for updates while dragging I actually need WM_SIZING. WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE just get sent once (makes sense), so the behaviour is the same as with OnResize currently. It renders okey, but from memory, I wouldn't say it renders any better then using OnResize (maynard philbrook's comment on the posted report implied it would). But I would need to have a side by side comparison to confirm that.
« Last Edit: February 16, 2023, 01:58:48 pm by big_M »

balazsszekely

  • Guest
Re: Resizing in win32
« Reply #9 on: February 16, 2023, 02:43:35 pm »
@ big_M
Quote
Ok, so for updates while dragging I actually need WM_SIZING.
Yes you're right, I misunderstood your question, you indeed need WM_SIZING. Sorry for that!

Quote
It renders okey, but from memory, I wouldn't say it renders any better then using OnResize
As @nanobit already mentioned the resizing mechanism is broken in the latest stable release Lazarus 2.2.4, however it works fine with Lazarus trunk/main(just tested). So if you use 2.2.4 you need to catch WM_SIZING, in other version you can use the OnResize event.

PS: Current bug aside,  in my experience combining WM_SIZING with WM_ENTERSIZEMOVE/WM_EXITSIZEMOVE gives you a much finer control, I prefer catching those messages, over OnResize in windows.

big_M

  • Jr. Member
  • **
  • Posts: 95
Re: Resizing in win32
« Reply #10 on: February 16, 2023, 03:07:00 pm »
Yes you're right, I misunderstood your question, you indeed need WM_SIZING. Sorry for that!
No problem at all. Thanks for your help!

Quote
PS: Current bug aside,  in my experience combining WM_SIZING with WM_ENTERSIZEMOVE/WM_EXITSIZEMOVE gives you a much finer control, I prefer catching those messages, over OnResize in windows.
Yes, I see. It can certainly be helpflull in some situations

 

TinyPortal © 2005-2018