Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-02

TWinControl.WMSize loop on WinCE

9 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

patspiper

I have finally found the trigger, though not the cause, of the dreaded 'TWinControl.WMSize loop detected' exception that prevents the use of TCalendarDialog, TDateEdit, and TDateTimePicker with WinCE (http://bugs.freepascal.org/view.php?id=21282). These 3 controls consist of a TCalendar (with either Autosize=True or AlignalNone) embedded on a form. It is this particular autosizing/aligning which triggers the exception as setting Autosize to False and Align to AlNone works well.

TCalendar's width is 220 while the screen's width is 240 (my WinCE device). I tried to reproduce the error on a Linux desktop by enlarging TCalendar to be almost as wide as the screen with no success.

Any hints/ideas on what might be going on here?

Note: I have attached a patch (for testing) to the bug report, but this is a workaround and not THE solution.

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 13 lines
I have finally found the trigger, though not the cause, of the dreaded 'TWinControl.WMSize loop detected' exception that prevents the use of TCalendarDialog, TDateEdit, and TDateTimePicker with WinCE (http://bugs.freepascal.org/view.php?id=21282). These 3 controls consist of a TCalendar (with either Autosize=True or AlignalNone) embedded on a form. It is this particular autosizing/aligning which triggers the exception as setting Autosize to False and Align to AlNone works well. TCalendar's width is 220 while the screen's width is 240 (my WinCE device). I tried to reproduce the error on a Linux desktop by enlarging TCalendar to be almost as wide as the screen with no success. Any hints/ideas on what might be going on here?

Maybe on WinCE the calendar is limited to some Width, but the WinCE interface does not report the correct constraints.

Calendar1.Constraints.Min/MaxInterfaceWidth

In this case the LCL sets a Width and the WinCE sets another creating a loop.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 23 lines
On Mon, 09 Feb 2015 21:55:59 +0200 patspiper wrote: > I have finally found the trigger, though not the cause, of the dreaded > 'TWinControl.WMSize loop detected' exception that prevents the use of > TCalendarDialog, TDateEdit, and TDateTimePicker with WinCE > (http://bugs.freepascal.org/view.php?id=21282). These 3 controls consist > of a TCalendar (with either Autosize=True or AlignalNone) embedded on > a form. It is this particular autosizing/aligning which triggers the > exception as setting Autosize to False and Align to AlNone works well. > > TCalendar's width is 220 while the screen's width is 240 (my WinCE > device). I tried to reproduce the error on a Linux desktop by enlarging > TCalendar to be almost as wide as the screen with no success. > > Any hints/ideas on what might be going on here? Maybe on WinCE the calendar is limited to some Width, but the WinCE interface does not report the correct constraints. Calendar1.Constraints.Min/MaxInterfaceWidth In this case the LCL sets a Width and the WinCE sets another creating a loop.

I put a TCalendar with no autosizing/aligning and a TEdit with Align=AlBottom on the main form.
xxx.Constraints.Min/MaxInterfaceWidth for both components are 0/0 on WinCE and 1/0 on Linux (I used a button to trigger the output of the values).

Note that setting the calendar's autosize to true will cause the WMSize loop on program startup. This is not the case for the TEdit (setting Align to AlBottom works fine).

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 9 lines
[...] > Calendar1.Constraints.Min/MaxInterfaceWidth > > In this case the LCL sets a Width and the WinCE sets another creating a > loop. I put a TCalendar with no autosizing/aligning and a TEdit with Align=AlBottom on the main form. xxx.Constraints.Min/MaxInterfaceWidth for both components are 0/0 on WinCE

This means the LCL assumes that TCalender can have any size on WinCE.

Set TForm OnResize:
  Calendar1.GetPreferredSize(w,h);
  Calendar1.SetBounds(0,0,w,h);

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 17 lines
On Mon, 09 Feb 2015 22:41:04 +0200 patspiper wrote: > [...] >> Calendar1.Constraints.Min/MaxInterfaceWidth >> >> In this case the LCL sets a Width and the WinCE sets another creating a >> loop. > I put a TCalendar with no autosizing/aligning and a TEdit with > Align=AlBottom on the main form. > xxx.Constraints.Min/MaxInterfaceWidth for both components are 0/0 on > WinCE This means the LCL assumes that TCalender can have any size on WinCE. Set TForm OnResize: Calendar1.GetPreferredSize(w,h); Calendar1.SetBounds(0,0,w,h);

The loop is still present (Calendar1.Align=AlBottom). However, note that the main's form autosize property is false (although WinCE might resize it anyway).

Any other things to try?

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 21 lines
On 09/02/15 22:52, Mattias Gaertner wrote: > On Mon, 09 Feb 2015 22:41:04 +0200 > patspiper wrote: > >> [...] >>> Calendar1.Constraints.Min/MaxInterfaceWidth >>> >>> In this case the LCL sets a Width and the WinCE sets another creating a >>> loop. >> I put a TCalendar with no autosizing/aligning and a TEdit with >> Align=AlBottom on the main form. >> xxx.Constraints.Min/MaxInterfaceWidth for both components are 0/0 on >> WinCE > This means the LCL assumes that TCalender can have any size on WinCE. > > Set TForm OnResize: > Calendar1.GetPreferredSize(w,h); > Calendar1.SetBounds(0,0,w,h); The loop is still present (Calendar1.Align=AlBottom). However, note that the main's form autosize property is false (although WinCE might resize it anyway).

Please set Calendar1.Align=alNone.
Does
TForm OnResize

   Calendar1.GetPreferredSize(w,h);
   Calendar1.SetBounds(0,0,w,h);

create a loop?

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 31 lines
On Mon, 09 Feb 2015 23:11:47 +0200 patspiper wrote: > On 09/02/15 22:52, Mattias Gaertner wrote: >> On Mon, 09 Feb 2015 22:41:04 +0200 >> patspiper wrote: >> >>> [...] >>>> Calendar1.Constraints.Min/MaxInterfaceWidth >>>> >>>> In this case the LCL sets a Width and the WinCE sets another creating a >>>> loop. >>> I put a TCalendar with no autosizing/aligning and a TEdit with >>> Align=AlBottom on the main form. >>> xxx.Constraints.Min/MaxInterfaceWidth for both components are 0/0 on >>> WinCE >> This means the LCL assumes that TCalender can have any size on WinCE. >> >> Set TForm OnResize: >> Calendar1.GetPreferredSize(w,h); >> Calendar1.SetBounds(0,0,w,h); > The loop is still present (Calendar1.Align=AlBottom). However, note that > the main's form autosize property is false (although WinCE might resize > it anyway). Please set Calendar1.Align=alNone. Does TForm OnResize Calendar1.GetPreferredSize(w,h); Calendar1.SetBounds(0,0,w,h); create a loop?

It doesn't.

Stephano

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 11 lines
On Mon, 09 Feb 2015 23:35:39 +0200 patspiper wrote: > [...] >> create a loop? > It doesn't. Does this create a loop: Calendar OnResize Calendar1.SetBounds(0,0,ClientWidth,ClientHeight-50);

I removed the TForm OnResize and put the above in Calendar OnResize. With AlNone there is no loop. WIth AlBottom there is.

Stephano

Reply by email