From 2755e979edb5fdf74a448feb754d0e2ab9a858a0 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 27 May 2010 20:50:09 +0000 Subject: [PATCH] Fixes WinCE TStringGrid scrollbar showing git-svn-id: trunk@25710 - --- .gitattributes | 1 + lcl/interfaces/wince/wincewsfactory.pas | 8 ++- lcl/interfaces/wince/wincewsgrids.pp | 80 +++++++++++++++++++++++++ lcl/interfaces/wince/wincewsstdctrls.pp | 2 +- 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 lcl/interfaces/wince/wincewsgrids.pp diff --git a/.gitattributes b/.gitattributes index f864b96524..789a53fac7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4943,6 +4943,7 @@ lcl/interfaces/wince/wincewsdialogs.pp svneol=native#text/plain lcl/interfaces/wince/wincewsextctrls.pp svneol=native#text/plain lcl/interfaces/wince/wincewsfactory.pas svneol=native#text/pascal lcl/interfaces/wince/wincewsforms.pp svneol=native#text/plain +lcl/interfaces/wince/wincewsgrids.pp svneol=native#text/plain lcl/interfaces/wince/wincewsimglist.pp svneol=native#text/pascal lcl/interfaces/wince/wincewsmenus.pp svneol=native#text/plain lcl/interfaces/wince/wincewsspin.pp svneol=native#text/plain diff --git a/lcl/interfaces/wince/wincewsfactory.pas b/lcl/interfaces/wince/wincewsfactory.pas index 7fe0fa67fe..5958708358 100644 --- a/lcl/interfaces/wince/wincewsfactory.pas +++ b/lcl/interfaces/wince/wincewsfactory.pas @@ -5,7 +5,7 @@ unit WinCEWSFactory; interface uses Classes, Controls, ComCtrls, ImgList, Calendar, StdCtrls, Arrow, Spin, - Dialogs, ExtCtrls, Buttons, CheckLst, Forms, Menus, + Dialogs, ExtCtrls, Buttons, CheckLst, Forms, Menus, Grids, WSLCLClasses; // imglist @@ -110,7 +110,8 @@ uses WinCEWSImgList, WinCEWSMenus, WinCEWSSpin, - WinCEWSStdCtrls; + WinCEWSStdCtrls, + WinCEWSGrids; // imglist function RegisterCustomImageList: Boolean; alias : 'WSRegisterCustomImageList'; @@ -492,7 +493,8 @@ end; // Grids function RegisterCustomGrid: Boolean; alias : 'WSRegisterCustomGrid'; begin - Result := False; + RegisterWSComponent(TCustomGrid, TWinCEWSCustomGrid); + Result := True; end; // Menus diff --git a/lcl/interfaces/wince/wincewsgrids.pp b/lcl/interfaces/wince/wincewsgrids.pp new file mode 100644 index 0000000000..d81590c43f --- /dev/null +++ b/lcl/interfaces/wince/wincewsgrids.pp @@ -0,0 +1,80 @@ +{ $Id: wincewsgrids.pp 23636 2010-02-05 07:53:33Z paul $} +{ + ***************************************************************************** + * WinCEWSGrids.pp * + * --------------- * + * * + * * + ***************************************************************************** + + ***************************************************************************** + * * + * This file is part of the Lazarus Component Library (LCL) * + * * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * for details about the copyright. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * * + ***************************************************************************** +} +unit WinCEWSGrids; + +{$mode objfpc}{$H+} + +interface + +uses + // RTL, FCL + Windows, + // LCL + LCLType, LCLProc, Controls, + // Widgetset + WSGrids, WinCEWSControls, WinCEInt; + +type + { TWinCEWSCustomGrid } + + TWinCEWSCustomGrid = class(TWSCustomGrid) + published + class function CreateHandle(const AWinControl: TWinControl; + const AParams: TCreateParams): TLCLIntfHandle; override; +// class procedure SendCharToEditor(AEditor:TWinControl; Ch: TUTF8Char); override; + end; + +implementation + +{ TWinCEWSCustomGrid } + +// We need to implement this to remove WS_VSCROLL and WS_HSCROLL, +// which don't do anything useful under WinCE. The behavior changes +// according to platform and is somewhat bad. Probably substitute with +// adding a TScrollBar. See here: +// +// +class function TWinCEWSCustomGrid.CreateHandle(const AWinControl: TWinControl; + const AParams: TCreateParams): TLCLIntfHandle; +var + Params: TCreateWindowExParams; +begin + {$ifdef VerboseWinCE} + DebugLn(' TWinCEWSWinControl.CreateHandle '); + {$endif} + // general initialization of Params + PrepareCreateWindow(AWinControl, AParams, Params); + // customization of Params + with Params do + begin + pClassName := @ClsName; + WindowTitle := StrCaption; + SubClassWndProc := nil; + Flags := (Flags and not WS_VSCROLL) and not WS_HSCROLL; + end; + // create window + FinishCreateWindow(AWinControl, Params, false); + Result := Params.Window; +end; + +end. diff --git a/lcl/interfaces/wince/wincewsstdctrls.pp b/lcl/interfaces/wince/wincewsstdctrls.pp index 3992819509..93d89a9b7d 100644 --- a/lcl/interfaces/wince/wincewsstdctrls.pp +++ b/lcl/interfaces/wince/wincewsstdctrls.pp @@ -320,7 +320,7 @@ const function ScrollBarWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam; - LParam: Windows.LParam): LResult; stdcall; + LParam: Windows.LParam): LResult; {$ifdef Win32}stdcall;{$else}cdecl;{$endif} begin case Msg of WM_PAINT,