View Issue Details

IDProjectCategoryView StatusLast Update
0025966LazarusLCLpublic2018-11-27 12:30
ReporternikAssigned ToLacaK 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version2.1 (SVN) 
Summary0025966: InputBox dialog is to wide on a Windows CE device
DescriptionWhen using InputBox on a Windows CE device, the dialog is wider then the screen resolution.
Additional Informationlazarus-1.2.0-fpc-2.6.2-win32
lazarus-1.2.0-fpc-2.6.2-cross-arm-wince-win32

Compiled in Win XP, 7. Runs in WinCE 5.00
TagsNo tags attached.
Fixed in Revision59676
LazTarget-
WidgetsetWinCE
Attached Files
  • pc_capture3.jpg (8,021 bytes)
    pc_capture3.jpg (8,021 bytes)
  • pc_capture1.jpg (32,133 bytes)
    pc_capture1.jpg (32,133 bytes)
  • InputBoxWidth.zip (1,877 bytes)
  • Untitled.jpg (21,633 bytes)
    Untitled.jpg (21,633 bytes)
  • WinCE InputBoxWidth patch.diff (539 bytes)
    Index: lcl/include/inputdialog.inc
    ===================================================================
    --- lcl/include/inputdialog.inc	(revision 50454)
    +++ lcl/include/inputdialog.inc	(working copy)
    @@ -59,6 +59,7 @@
           MinEditWidth := Min(AMonitor.Width - 20,
             Max(cInputQueryEditSizePixels,
                 AMonitor.Width * cInputQueryEditSizePercents div 100));
    +      MinEditWidth := Min(MinEditWidth, _InputQueryActiveMonitor.Width);
           Constraints.MinWidth := MinEditWidth;
           Text := Value;
           TabStop := True;
    
  • WinCE InputBoxWidth patch2.diff (664 bytes)
    Index: lcl/include/inputdialog.inc
    ===================================================================
    --- lcl/include/inputdialog.inc	(revision 58414)
    +++ lcl/include/inputdialog.inc	(working copy)
    @@ -59,6 +59,10 @@
           MinEditWidth := Min(AMonitor.Width - 20,
             Max(cInputQueryEditSizePixels,
                 AMonitor.Width * cInputQueryEditSizePercents div 100));
    +{$IFDEF WINCE}
    +// Temporary workaround for WinCE bug #25966 (InputBox dialog is to wide on a Windows CE device)
    +      MinEditWidth := Min(MinEditWidth, _InputQueryActiveMonitor.Width);
    +{$ENDIF}
           Constraints.MinWidth := MinEditWidth;
           Text := Value;
           TabStop := True;
    
  • n2.diff (1,004 bytes)
    Index: lcl/include/inputdialog.inc
    ===================================================================
    --- lcl/include/inputdialog.inc	(revision 58424)
    +++ lcl/include/inputdialog.inc	(working copy)
    @@ -29,11 +29,13 @@
       AMonitor: TMonitor;
     begin
       Result := False;
    +  AMonitor := _InputQueryActiveMonitor;
       Form := TForm(TForm.NewInstance);
       Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowInputDialog'){$ENDIF};
       Form.CreateNew(nil, 0);
       with Form do
       begin
    +    Constraints.MaxWidth := AMonitor.Width - 10; // to fix dialog too wide on WinCE
         PopupMode := pmAuto;
         BorderStyle := bsDialog;
         Caption := InputCaption;
    @@ -53,7 +55,6 @@
           Top := Prompt.Height;
           Align := alTop;
           BorderSpacing.Top := 3;
    -      AMonitor := _InputQueryActiveMonitor;
           // check that edit is smaller than our monitor, it must be smaller at least
           // by 6 * 2 pixels (spacing from window borders) + window border
           MinEditWidth := Min(AMonitor.Width - 20,
    
    n2.diff (1,004 bytes)
  • wincewinapi.inc.1.patch (2,640 bytes)
    Index: lcl/interfaces/wince/wincewinapi.inc
    ===================================================================
    --- lcl/interfaces/wince/wincewinapi.inc	(revision 59463)
    +++ lcl/interfaces/wince/wincewinapi.inc	(working copy)
    @@ -2148,7 +2148,7 @@
     
       Returns the current widget Width and Height
     
    -  Note: Windows.GetWindowInfo doesnt exist in wince, but
    +  Note: Windows.GetWindowInfo doesnt exist in WinCE, but
       we can use GetWindowLong and other APIs for most information
     
       Also GetWindowPlacement doesnt exist
    @@ -2197,7 +2197,7 @@
       if not Result then Exit;
     
       // No special handling for maximized windows
    -  // they do not exist in wince anyway, they are
    +  // they do not exist in WinCE anyway, they are
       // emulated by calculating the desktop size
       Width := R.Right - R.Left;
       Height := R.Bottom - R.Top;
    @@ -2216,11 +2216,21 @@
         if (WindowInfo^.WinControl is TCustomForm) then
         begin
           // The borders are not given by the same constants in Win32 and WinCE
    -      // Bug http://bugs.freepascal.org/view.php?id=11456
    +      // Bug https://bugs.freepascal.org/view.php?id=11456
    +      //     https://bugs.freepascal.org/view.php?id=25966
           //
    +      // SM_CXSIZEFRAME,SM_CYSIZEFRAME are not supported on Windows CE
           // SM_CXSIZEFRAME returns 3 in my tests, but the real border
           // is only 1 pixel wide, like SM_CXBORDER
           {$IFDEF WinCE}
    +        if ((Style and WS_THICKFRAME) <> 0) {bsSizeable} or
    +           ((Style and (WS_BORDER or WS_POPUP)) = (WS_BORDER or WS_POPUP)) {bsDialog} then
    +        begin
    +          // thick, sizing border
    +          // add twice, top+bottom border
    +          Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
    +          Dec(Height, 2*Windows.GetSystemMetrics(SM_CYFIXEDFRAME));
    +        end else
             if (Style and WS_BORDER) <> 0 then
             begin
               // thin, non-sizing border
    @@ -2228,7 +2238,7 @@
               Dec(Height, 2*Windows.GetSystemMetrics(SM_CYBORDER));
             end;
           {$ELSE}
    -        if (Style and WS_THICKFRAME) <> 0 then
    +        if (Style and and (WS_CHILD or WS_THICKFRAME)) = WS_THICKFRAME then
             begin
               // thick, sizing border
               // add twice, top+bottom border
    @@ -2235,7 +2245,7 @@
               Dec(Width, 2*Windows.GetSystemMetrics(SM_CXSIZEFRAME));
               Dec(Height, 2*Windows.GetSystemMetrics(SM_CYSIZEFRAME));
             end else
    -        if (Style and WS_BORDER) <> 0 then
    +        if (Style and (WS_CHILD or WS_BORDER)) = WS_BORDER then
             begin
               // thin, non-sizing border
               Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
    
    wincewinapi.inc.1.patch (2,640 bytes)
  • wincewinapi.inc.2.patch (3,831 bytes)
    Index: lcl/interfaces/wince/wincewinapi.inc
    ===================================================================
    --- lcl/interfaces/wince/wincewinapi.inc	(revision 59463)
    +++ lcl/interfaces/wince/wincewinapi.inc	(working copy)
    @@ -2148,7 +2148,7 @@
     
       Returns the current widget Width and Height
     
    -  Note: Windows.GetWindowInfo doesnt exist in wince, but
    +  Note: Windows.GetWindowInfo doesnt exist in WinCE, but
       we can use GetWindowLong and other APIs for most information
     
       Also GetWindowPlacement doesnt exist
    @@ -2156,7 +2156,7 @@
     function TWinCEWidgetSet.GetWindowSize(Handle : hwnd;
       var Width, Height: integer): boolean;
     var
    -  R: TRect;
    +  R, R0: TRect;
       WindowInfo: PWindowInfo;
       Style, ExStyle: longint;
       {$IFDEF VerboseSizeMsg}
    @@ -2197,7 +2197,7 @@
       if not Result then Exit;
     
       // No special handling for maximized windows
    -  // they do not exist in wince anyway, they are
    +  // they do not exist in WinCE anyway, they are
       // emulated by calculating the desktop size
       Width := R.Right - R.Left;
       Height := R.Bottom - R.Top;
    @@ -2216,11 +2216,26 @@
         if (WindowInfo^.WinControl is TCustomForm) then
         begin
           // The borders are not given by the same constants in Win32 and WinCE
    -      // Bug http://bugs.freepascal.org/view.php?id=11456
    +      // Bug https://bugs.freepascal.org/view.php?id=11456
    +      //     https://bugs.freepascal.org/view.php?id=25966
           //
    +      // SM_CXSIZEFRAME,SM_CYSIZEFRAME are not supported on Windows CE
           // SM_CXSIZEFRAME returns 3 in my tests, but the real border
           // is only 1 pixel wide, like SM_CXBORDER
           {$IFDEF WinCE}
    +        R0 := Rect(0,0,0,0);
    +        Windows.AdjustWindowRectEx(@R0, Style, False, ExStyle);
    +        Dec(Width, R0.Width);
    +        Dec(Height, R0.Height);
    +(*
    +        if ((Style and WS_THICKFRAME) <> 0) {bsSizeable} or
    +           ((Style and (WS_BORDER or WS_POPUP)) = (WS_BORDER or WS_POPUP)) {bsDialog} then
    +        begin
    +          // thick, sizing border
    +          // add twice, top+bottom border
    +          Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
    +          Dec(Height, 2*Windows.GetSystemMetrics(SM_CYFIXEDFRAME));
    +        end else
             if (Style and WS_BORDER) <> 0 then
             begin
               // thin, non-sizing border
    @@ -2227,8 +2242,9 @@
               Dec(Width, 2*Windows.GetSystemMetrics(SM_CXBORDER));
               Dec(Height, 2*Windows.GetSystemMetrics(SM_CYBORDER));
             end;
    +*)
           {$ELSE}
    -        if (Style and WS_THICKFRAME) <> 0 then
    +        if (Style and and (WS_CHILD or WS_THICKFRAME)) = WS_THICKFRAME then
             begin
               // thick, sizing border
               // add twice, top+bottom border
    @@ -2235,20 +2251,20 @@
               Dec(Width, 2*Windows.GetSystemMetrics(SM_CXSIZEFRAME));
               Dec(Height, 2*Windows.GetSystemMetrics(SM_CYSIZEFRAME));
             end else
    -        if (Style and WS_BORDER) <> 0 then
    +        if (Style and (WS_CHILD or WS_BORDER)) = WS_BORDER then
             begin
               // thin, non-sizing border
               Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
               Dec(Height, 2*Windows.GetSystemMetrics(SM_CYFIXEDFRAME));
             end;
    +
    +        // ExcludeCaption
    +        if ((Style and WS_CAPTION) <> 0) then
    +          if (ExStyle and WS_EX_TOOLWINDOW) <> 0 then
    +            Dec(Height, Windows.GetSystemMetrics(SM_CYSMCAPTION))
    +          else
    +            Dec(Height, Windows.GetSystemMetrics(SM_CYCAPTION));
           {$ENDIF}
    -
    -      // ExcludeCaption
    -      if ((Style and WS_CAPTION) <> 0) then
    -        if (ExStyle and WS_EX_TOOLWINDOW) <> 0 then
    -          Dec(Height, Windows.GetSystemMetrics(SM_CYSMCAPTION))
    -        else
    -          Dec(Height, Windows.GetSystemMetrics(SM_CYCAPTION));
         end;
     
         if (WindowInfo^.WinControl is TCustomFloatSpinEdit) then
    
    wincewinapi.inc.2.patch (3,831 bytes)

Relationships

related to 0011456 closedFelipe Monteiro de Carvalho Problems with dialog-sizes 

Activities

nik

2014-04-03 11:59

reporter  

pc_capture3.jpg (8,021 bytes)
pc_capture3.jpg (8,021 bytes)

nik

2014-04-03 12:01

reporter  

pc_capture1.jpg (32,133 bytes)
pc_capture1.jpg (32,133 bytes)

Stephano

2015-10-15 10:40

developer   ~0086597

Can't reproduce. Need other testers to confirm before marking as resolved.

Stephano

2015-10-18 11:15

developer  

InputBoxWidth.zip (1,877 bytes)

LacaK

2015-10-21 08:44

developer   ~0086762

Lazarus 1.4.4, WinCE 6, Motorola MC9190G:
 Same result as reporter wrote: Dialog box is out of screen (pc_capture3.jpg)

ertank

2015-11-10 14:23

reporter  

Untitled.jpg (21,633 bytes)
Untitled.jpg (21,633 bytes)

ertank

2015-11-10 14:24

reporter   ~0087220

Lazarus 1.4.4, Windows Embedded CE 6.0, DISC:
I have no problem with the width of the InputBox. Check Untitled.jpg uploaded on 2015-11-10 14:23.

Stephano

2015-11-21 13:21

developer   ~0087444

It may have to do with the display horizontal resolution. Mine is WQVGA (400x240).

Alexey Tor.

2015-11-21 14:15

reporter   ~0087447

Dialogs has
  cInputQueryEditSizePixels: integer = 260; // Edit size in pixels
  cInputQueryEditSizePercents: integer = 25; // Edit size in % of monitor width
pls try changing

Stephano

2015-11-21 16:05

developer   ~0087453

@Alexy, good catch!

Pls try attached patch.

Stephano

2015-11-21 16:06

developer  

WinCE InputBoxWidth patch.diff (539 bytes)
Index: lcl/include/inputdialog.inc
===================================================================
--- lcl/include/inputdialog.inc	(revision 50454)
+++ lcl/include/inputdialog.inc	(working copy)
@@ -59,6 +59,7 @@
       MinEditWidth := Min(AMonitor.Width - 20,
         Max(cInputQueryEditSizePixels,
             AMonitor.Width * cInputQueryEditSizePercents div 100));
+      MinEditWidth := Min(MinEditWidth, _InputQueryActiveMonitor.Width);
       Constraints.MinWidth := MinEditWidth;
       Text := Value;
       TabStop := True;

Stephano

2018-06-27 10:13

developer   ~0109081

Added to patch specific IFDEF for WinCE.

Stephano

2018-06-27 10:14

developer  

WinCE InputBoxWidth patch2.diff (664 bytes)
Index: lcl/include/inputdialog.inc
===================================================================
--- lcl/include/inputdialog.inc	(revision 58414)
+++ lcl/include/inputdialog.inc	(working copy)
@@ -59,6 +59,10 @@
       MinEditWidth := Min(AMonitor.Width - 20,
         Max(cInputQueryEditSizePixels,
             AMonitor.Width * cInputQueryEditSizePercents div 100));
+{$IFDEF WINCE}
+// Temporary workaround for WinCE bug #25966 (InputBox dialog is to wide on a Windows CE device)
+      MinEditWidth := Min(MinEditWidth, _InputQueryActiveMonitor.Width);
+{$ENDIF}
       Constraints.MinWidth := MinEditWidth;
       Text := Value;
       TabStop := True;

Juha Manninen

2018-07-01 16:01

developer   ~0109159

The patch is not good because it adds widgetset specific code into LCL.
What happens if you enable the line :
  MinEditWidth := Min(MinEditWidth, _InputQueryActiveMonitor.Width);
for other widgetsets?

Alexey Tor.

2018-07-01 17:38

reporter   ~0109161

Patch is not good. also because it makes weird logic.
1) why
      MinEditWidth := Min(AMonitor.Width - 20,

don't work? It makes TEdit min width like minitor width - 20. it must be small value and dialog must fit.

What WinCE does report for your Screen.Monitors[0].Width, .Height?

2) What if you add

  with Form do
  begin
    Constraints.MaxWidth := AMonitor.Width - 10;

in function DefaultInputDialog in inputdialog.inc?

3) what if you change
      MinEditWidth := Min(AMonitor.Width - 20,
to
      MinEditWidth := Min(AMonitor.Width - 40,
?

Stephano

2018-07-02 11:38

developer   ~0109180

Lacak and nik's feedback is needed as they have devices which exhibit the bug symptoms.

LacaK

2018-07-02 12:51

developer   ~0109183

In my case:

1) Screen.Monitors[0].Width=240, Screen.Monitors[0].Height=320

2) It works (dialog fits inside screen) (of course I have moved also "AMonitor := _InputQueryActiveMonitor;" before "with Form do")

3) Nothing happens (even when I use "-60"). May be, that MinWidth is not a problem.

If I can test something else let me know.

Alexey Tor.

2018-07-02 13:21

reporter  

n2.diff (1,004 bytes)
Index: lcl/include/inputdialog.inc
===================================================================
--- lcl/include/inputdialog.inc	(revision 58424)
+++ lcl/include/inputdialog.inc	(working copy)
@@ -29,11 +29,13 @@
   AMonitor: TMonitor;
 begin
   Result := False;
+  AMonitor := _InputQueryActiveMonitor;
   Form := TForm(TForm.NewInstance);
   Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowInputDialog'){$ENDIF};
   Form.CreateNew(nil, 0);
   with Form do
   begin
+    Constraints.MaxWidth := AMonitor.Width - 10; // to fix dialog too wide on WinCE
     PopupMode := pmAuto;
     BorderStyle := bsDialog;
     Caption := InputCaption;
@@ -53,7 +55,6 @@
       Top := Prompt.Height;
       Align := alTop;
       BorderSpacing.Top := 3;
-      AMonitor := _InputQueryActiveMonitor;
       // check that edit is smaller than our monitor, it must be smaller at least
       // by 6 * 2 pixels (spacing from window borders) + window border
       MinEditWidth := Min(AMonitor.Width - 20,
n2.diff (1,004 bytes)

Alexey Tor.

2018-07-02 13:22

reporter   ~0109187

LacaK,
pls try patch n2.diff (it is from 2] item)

LacaK

2018-07-02 13:33

developer   ~0109189

Yes works (but as far as Lazarus 1.8+ is broken on WinCE I have tested patch with FPC 3.0.4 + Lazarus 1.6.4 + your patch)
What I do not understand is why this patch is not needed for Win32?
May be that there is deeper problem on WinCE (something that works correctly on Win32 so the bug is visible only on WinCE)?

LacaK

2018-11-06 10:09

developer   ~0111807

Last edited: 2018-11-06 10:20

View 6 revisions

Diference between Win32 and WinCE is that in case of WinCE when procedure TCustomForm.GetPreferredSize is called there is already set fsDisableAutoSize.
fsDisableAutoSize is set because TCustomForm.WMSize is called repeatedly.

The root of problem is that TWinCEWidgetSet.GetWindowSize returns incorrect window size. Borders of window are not correctly subtracted and this causes resizing of window do in loop,
which causes that fsDisableAutoSize is set and this prevent autosizing dialog window.

In my environment (WinCE 6, Motorola MC9190):
 bsSizeable: WS_THICKFRAME: 3px = SM_C*FIXEDFRAME (in GetSystemMetrics call)
 bsSingle : WS_BORDER: 1px = SM_C*BORDER
 bsDialog : WS_BORDER+WS_POPUP: 3px = SM_C*FIXEDFRAME

SM_CXSIZEFRAME,SM_CYSIZEFRAME are not supported on Windows CE: https://msdn.microsoft.com/en-us/library/ms960850.aspx

wincewinapi.inc.1 patch uses above mentioned approach.
wincewinapi.inc.2 patch uses Windows.AdjustWindowRectEx symetricaly to TWinCEWSCustomForm.SetBounds to determine window borders

LacaK

2018-11-06 10:09

developer  

wincewinapi.inc.1.patch (2,640 bytes)
Index: lcl/interfaces/wince/wincewinapi.inc
===================================================================
--- lcl/interfaces/wince/wincewinapi.inc	(revision 59463)
+++ lcl/interfaces/wince/wincewinapi.inc	(working copy)
@@ -2148,7 +2148,7 @@
 
   Returns the current widget Width and Height
 
-  Note: Windows.GetWindowInfo doesnt exist in wince, but
+  Note: Windows.GetWindowInfo doesnt exist in WinCE, but
   we can use GetWindowLong and other APIs for most information
 
   Also GetWindowPlacement doesnt exist
@@ -2197,7 +2197,7 @@
   if not Result then Exit;
 
   // No special handling for maximized windows
-  // they do not exist in wince anyway, they are
+  // they do not exist in WinCE anyway, they are
   // emulated by calculating the desktop size
   Width := R.Right - R.Left;
   Height := R.Bottom - R.Top;
@@ -2216,11 +2216,21 @@
     if (WindowInfo^.WinControl is TCustomForm) then
     begin
       // The borders are not given by the same constants in Win32 and WinCE
-      // Bug http://bugs.freepascal.org/view.php?id=11456
+      // Bug https://bugs.freepascal.org/view.php?id=11456
+      //     https://bugs.freepascal.org/view.php?id=25966
       //
+      // SM_CXSIZEFRAME,SM_CYSIZEFRAME are not supported on Windows CE
       // SM_CXSIZEFRAME returns 3 in my tests, but the real border
       // is only 1 pixel wide, like SM_CXBORDER
       {$IFDEF WinCE}
+        if ((Style and WS_THICKFRAME) <> 0) {bsSizeable} or
+           ((Style and (WS_BORDER or WS_POPUP)) = (WS_BORDER or WS_POPUP)) {bsDialog} then
+        begin
+          // thick, sizing border
+          // add twice, top+bottom border
+          Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
+          Dec(Height, 2*Windows.GetSystemMetrics(SM_CYFIXEDFRAME));
+        end else
         if (Style and WS_BORDER) <> 0 then
         begin
           // thin, non-sizing border
@@ -2228,7 +2238,7 @@
           Dec(Height, 2*Windows.GetSystemMetrics(SM_CYBORDER));
         end;
       {$ELSE}
-        if (Style and WS_THICKFRAME) <> 0 then
+        if (Style and and (WS_CHILD or WS_THICKFRAME)) = WS_THICKFRAME then
         begin
           // thick, sizing border
           // add twice, top+bottom border
@@ -2235,7 +2245,7 @@
           Dec(Width, 2*Windows.GetSystemMetrics(SM_CXSIZEFRAME));
           Dec(Height, 2*Windows.GetSystemMetrics(SM_CYSIZEFRAME));
         end else
-        if (Style and WS_BORDER) <> 0 then
+        if (Style and (WS_CHILD or WS_BORDER)) = WS_BORDER then
         begin
           // thin, non-sizing border
           Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
wincewinapi.inc.1.patch (2,640 bytes)

LacaK

2018-11-06 10:10

developer  

wincewinapi.inc.2.patch (3,831 bytes)
Index: lcl/interfaces/wince/wincewinapi.inc
===================================================================
--- lcl/interfaces/wince/wincewinapi.inc	(revision 59463)
+++ lcl/interfaces/wince/wincewinapi.inc	(working copy)
@@ -2148,7 +2148,7 @@
 
   Returns the current widget Width and Height
 
-  Note: Windows.GetWindowInfo doesnt exist in wince, but
+  Note: Windows.GetWindowInfo doesnt exist in WinCE, but
   we can use GetWindowLong and other APIs for most information
 
   Also GetWindowPlacement doesnt exist
@@ -2156,7 +2156,7 @@
 function TWinCEWidgetSet.GetWindowSize(Handle : hwnd;
   var Width, Height: integer): boolean;
 var
-  R: TRect;
+  R, R0: TRect;
   WindowInfo: PWindowInfo;
   Style, ExStyle: longint;
   {$IFDEF VerboseSizeMsg}
@@ -2197,7 +2197,7 @@
   if not Result then Exit;
 
   // No special handling for maximized windows
-  // they do not exist in wince anyway, they are
+  // they do not exist in WinCE anyway, they are
   // emulated by calculating the desktop size
   Width := R.Right - R.Left;
   Height := R.Bottom - R.Top;
@@ -2216,11 +2216,26 @@
     if (WindowInfo^.WinControl is TCustomForm) then
     begin
       // The borders are not given by the same constants in Win32 and WinCE
-      // Bug http://bugs.freepascal.org/view.php?id=11456
+      // Bug https://bugs.freepascal.org/view.php?id=11456
+      //     https://bugs.freepascal.org/view.php?id=25966
       //
+      // SM_CXSIZEFRAME,SM_CYSIZEFRAME are not supported on Windows CE
       // SM_CXSIZEFRAME returns 3 in my tests, but the real border
       // is only 1 pixel wide, like SM_CXBORDER
       {$IFDEF WinCE}
+        R0 := Rect(0,0,0,0);
+        Windows.AdjustWindowRectEx(@R0, Style, False, ExStyle);
+        Dec(Width, R0.Width);
+        Dec(Height, R0.Height);
+(*
+        if ((Style and WS_THICKFRAME) <> 0) {bsSizeable} or
+           ((Style and (WS_BORDER or WS_POPUP)) = (WS_BORDER or WS_POPUP)) {bsDialog} then
+        begin
+          // thick, sizing border
+          // add twice, top+bottom border
+          Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
+          Dec(Height, 2*Windows.GetSystemMetrics(SM_CYFIXEDFRAME));
+        end else
         if (Style and WS_BORDER) <> 0 then
         begin
           // thin, non-sizing border
@@ -2227,8 +2242,9 @@
           Dec(Width, 2*Windows.GetSystemMetrics(SM_CXBORDER));
           Dec(Height, 2*Windows.GetSystemMetrics(SM_CYBORDER));
         end;
+*)
       {$ELSE}
-        if (Style and WS_THICKFRAME) <> 0 then
+        if (Style and and (WS_CHILD or WS_THICKFRAME)) = WS_THICKFRAME then
         begin
           // thick, sizing border
           // add twice, top+bottom border
@@ -2235,20 +2251,20 @@
           Dec(Width, 2*Windows.GetSystemMetrics(SM_CXSIZEFRAME));
           Dec(Height, 2*Windows.GetSystemMetrics(SM_CYSIZEFRAME));
         end else
-        if (Style and WS_BORDER) <> 0 then
+        if (Style and (WS_CHILD or WS_BORDER)) = WS_BORDER then
         begin
           // thin, non-sizing border
           Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
           Dec(Height, 2*Windows.GetSystemMetrics(SM_CYFIXEDFRAME));
         end;
+
+        // ExcludeCaption
+        if ((Style and WS_CAPTION) <> 0) then
+          if (ExStyle and WS_EX_TOOLWINDOW) <> 0 then
+            Dec(Height, Windows.GetSystemMetrics(SM_CYSMCAPTION))
+          else
+            Dec(Height, Windows.GetSystemMetrics(SM_CYCAPTION));
       {$ENDIF}
-
-      // ExcludeCaption
-      if ((Style and WS_CAPTION) <> 0) then
-        if (ExStyle and WS_EX_TOOLWINDOW) <> 0 then
-          Dec(Height, Windows.GetSystemMetrics(SM_CYSMCAPTION))
-        else
-          Dec(Height, Windows.GetSystemMetrics(SM_CYCAPTION));
     end;
 
     if (WindowInfo^.WinControl is TCustomFloatSpinEdit) then
wincewinapi.inc.2.patch (3,831 bytes)

LacaK

2018-11-27 12:30

developer   ~0112230

I have applied patch "1". Test please and in case of problem reopen.

Issue History

Date Modified Username Field Change
2014-04-03 11:59 nik New Issue
2014-04-03 11:59 nik File Added: pc_capture3.jpg
2014-04-03 12:01 nik File Added: pc_capture1.jpg
2014-04-03 12:40 Jonas Maebe Project FPC => Lazarus
2015-02-06 18:11 Juha Manninen LazTarget => -
2015-02-06 18:11 Juha Manninen Widgetset => WinCE
2015-02-06 18:11 Juha Manninen Assigned To => Stephano
2015-02-06 18:11 Juha Manninen Status new => assigned
2015-10-15 10:40 Stephano Note Added: 0086597
2015-10-15 10:40 Stephano Status assigned => feedback
2015-10-18 11:15 Stephano File Added: InputBoxWidth.zip
2015-10-21 08:44 LacaK Note Added: 0086762
2015-11-10 14:23 ertank File Added: Untitled.jpg
2015-11-10 14:24 ertank Note Added: 0087220
2015-11-21 13:21 Stephano Note Added: 0087444
2015-11-21 14:15 Alexey Tor. Note Added: 0087447
2015-11-21 16:05 Stephano Note Added: 0087453
2015-11-21 16:06 Stephano File Added: WinCE InputBoxWidth patch.diff
2018-06-27 10:13 Stephano Note Added: 0109081
2018-06-27 10:14 Stephano File Added: WinCE InputBoxWidth patch2.diff
2018-07-01 16:01 Juha Manninen Note Added: 0109159
2018-07-01 17:38 Alexey Tor. Note Added: 0109161
2018-07-02 11:38 Stephano Note Added: 0109180
2018-07-02 12:51 LacaK Note Added: 0109183
2018-07-02 13:21 Alexey Tor. File Added: n2.diff
2018-07-02 13:22 Alexey Tor. Note Added: 0109187
2018-07-02 13:33 LacaK Note Added: 0109189
2018-11-05 15:23 LacaK Relationship added related to 0011456
2018-11-06 10:09 LacaK Note Added: 0111807
2018-11-06 10:09 LacaK File Added: wincewinapi.inc.1.patch
2018-11-06 10:10 LacaK File Added: wincewinapi.inc.2.patch
2018-11-06 10:14 LacaK Note Edited: 0111807 View Revisions
2018-11-06 10:16 LacaK Note Edited: 0111807 View Revisions
2018-11-06 10:17 LacaK Note Edited: 0111807 View Revisions
2018-11-06 10:18 LacaK Note Edited: 0111807 View Revisions
2018-11-06 10:20 LacaK Note Edited: 0111807 View Revisions
2018-11-27 12:30 LacaK Fixed in Revision => 59676
2018-11-27 12:30 LacaK Note Added: 0112230
2018-11-27 12:30 LacaK Status feedback => resolved
2018-11-27 12:30 LacaK Fixed in Version => 2.1 (SVN)
2018-11-27 12:30 LacaK Resolution open => fixed
2018-11-27 12:30 LacaK Assigned To Stephano => LacaK