1{
2 *****************************************************************************
3 *                            WinCEWSComCtrls.pp                             *
4 *                            ------------------                             *
5 *                                                                           *
6 *                                                                           *
7 *****************************************************************************
8
9 *****************************************************************************
10  This file is part of the Lazarus Component Library (LCL)
11
12  See the file COPYING.LCL, included in this distribution,
13  for details about the license.
14 *****************************************************************************
15}
16unit WinCEWSComCtrls;
17
18{$mode objfpc}{$H+}
19interface
20
21uses
22  // RTL, FCL
23  Windows, Classes, SysUtils, WinExt, Forms,
24  commctrl,
25  // Compatibility
26  {$ifdef Win32}win32compat,{$endif}
27  // LCL
28  ComCtrls, LCLType, Controls, Graphics,
29  ImgList, StdCtrls, Math, LCLIntf, ExtCtrls,
30  LazUTF8, InterfaceBase, LMessages, LCLMessageGlue,
31  // widgetset
32  WSComCtrls, WSLCLClasses, WSProc, WsControls,
33  WinCEInt, WinCEProc, WinCEWSControls, WinCEExtra;
34
35type
36  { TWinCEWSCustomPage }
37
38  TWinCEWSCustomPage = class(TWSCustomPage)
39  published
40    class function CreateHandle(const AWinControl: TWinControl;
41          const AParams: TCreateParams): HWND; override;
42    class procedure DestroyHandle(const AWinControl: TWinControl); override;
43    class procedure UpdateProperties(const ACustomPage: TCustomPage); override;
44    class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
45  end;
46
47  { TWinCEWSCustomNotebook }
48
49  TWinCEWSCustomNotebook = class(TWSCustomTabControl)
50  published
51    class function CreateHandle(const AWinControl: TWinControl;
52          const AParams: TCreateParams): HWND; override;
53    class procedure AddAllNBPages(const ATabControl: TCustomTabControl);
54    class procedure AdjustSizeNotebookPages(const ATabControl: TCustomTabControl);
55    class procedure AddPage(const ATabControl: TCustomTabControl;
56      const AChild: TCustomPage; const AIndex: integer); override;
57    class procedure MovePage(const ATabControl: TCustomTabControl;
58      const AChild: TCustomPage; const NewIndex: integer); override;
59    class procedure RemoveAllNBPages(const ATabControl: TCustomTabControl);
60    class procedure RemovePage(const ATabControl: TCustomTabControl;
61      const AIndex: integer); override;
62
63    class function GetTabIndexAtPos(const ATabControl: TCustomTabControl; const AClientPos: TPoint): integer; override;
64    class function GetTabRect(const ATabControl: TCustomTabControl; const AIndex: Integer): TRect; override;
65    class function GetCapabilities: TCTabControlCapabilities;override;
66    class function GetDesignInteractive(const AWinControl: TWinControl; AClientPos: TPoint): Boolean; override;
67    class procedure SetImageList(const ATabControl: TCustomTabControl; const AImageList: TCustomImageList);
68    class procedure SetPageIndex(const ATabControl: TCustomTabControl; const AIndex: integer); override;
69    class procedure SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition); override;
70    class procedure ShowTabs(const ATabControl: TCustomTabControl; AShowTabs: boolean); override;
71    class procedure UpdateProperties(const ATabControl: TCustomTabControl); override;
72  end;
73
74  { TWinCEWSStatusBar }
75
76  TWinCEWSStatusBar = class(TWSStatusBar)
77  published
78    class function  CreateHandle(const AWinControl: TWinControl;
79          const AParams: TCreateParams): HWND; override;
80    class procedure Update(const AStatusBar: TStatusBar); override;
81    class procedure PanelUpdate(const AStatusBar: TStatusBar; PanelIndex: integer); override;
82    class procedure SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer); override;
83    class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
84    class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop,
85      AWidth, AHeight: integer); override;
86    class procedure GetPreferredSize(const AWinControl: TWinControl;
87                        var PreferredWidth, PreferredHeight: integer;
88                        WithThemeSpace: Boolean); override;
89  end;
90
91  { TWinCEWSTabSheet }
92
93  TWinCEWSTabSheet = class(TWSTabSheet)
94  private
95  protected
96  public
97  end;
98
99  { TWinCEWSPageControl }
100
101  TWinCEWSPageControl = class(TWSPageControl)
102  private
103  protected
104  public
105  end;
106
107  { TWinCEWSCustomListView }
108
109  TWinCEWSCustomListView = class(TWSCustomListView)
110  private
111    class function  GetHeader(const AHandle: THandle): THandle;
112    class procedure PositionHeader(const AHandle: THandle);
113    class procedure UpdateStyle(const AHandle: THandle; const AMask, AStyle: Integer);
114    class procedure UpdateExStyle(const AHandle: THandle; const AMask, AStyle: Integer);
115    class procedure LVItemAssign(const ALV: TCustomListView; AItem: TListItem; const AIndex: Integer);
116  published
117    // columns
118    class procedure ColumnDelete(const ALV: TCustomListView; const AIndex: Integer); override;
119    class function  ColumnGetWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn): Integer; override;
120    class procedure ColumnInsert(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn); override;
121    class procedure ColumnMove(const ALV: TCustomListView; const AOldIndex, ANewIndex: Integer; const AColumn: TListColumn); override;
122    class procedure ColumnSetAlignment(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AAlignment: TAlignment); override;
123    class procedure ColumnSetAutoSize(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AAutoSize: Boolean); override;
124    class procedure ColumnSetCaption(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const ACaption: String); override;
125    class procedure ColumnSetImage(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AImageIndex: Integer); override;
126    class procedure ColumnSetMaxWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AMaxWidth: Integer); override;
127    class procedure ColumnSetMinWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AMinWidth: integer); override;
128    class procedure ColumnSetWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AWidth: Integer); override;
129    class procedure ColumnSetVisible(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AVisible: Boolean); override;
130
131    // items
132    class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); override;
133    class function  ItemDisplayRect(const ALV: TCustomListView; const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
134    class procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); override;
135    class procedure ItemMove(const ALV: TCustomListView; AItem: TListItem; const AFromIndex, AToIndex: Integer); override;
136    class function  ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem): Boolean; override;
137    class function  ItemGetPosition(const ALV: TCustomListView; const AIndex: Integer): TPoint; override;
138    class function  ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
139    class procedure ItemInsert(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem); override;
140    class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); override;
141    class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); override;
142    class function  ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; override;
143    class procedure ItemSetStateImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AStateImageIndex: Integer); override;
144    class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
145    class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
146    class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
147
148    // lv
149    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; override;
150
151    class procedure BeginUpdate(const ALV: TCustomListView); override;
152    class procedure EndUpdate(const ALV: TCustomListView); override;
153
154    class function GetBoundingRect(const ALV: TCustomListView): TRect; override;
155    class function GetDropTarget(const ALV: TCustomListView): Integer; override;
156    class function GetFocused(const ALV: TCustomListView): Integer; override;
157    class function GetHitTestInfoAt( const ALV: TCustomListView; X, Y: Integer ) : THitTests; override;
158    class function GetHoverTime(const ALV: TCustomListView): Integer; override;
159    class function GetItemAt(const ALV: TCustomListView; x,y: Integer): Integer; override;
160    class function GetSelCount(const ALV: TCustomListView): Integer; override;
161    class function GetSelection(const ALV: TCustomListView): Integer; override;
162    class function GetTopItem(const ALV: TCustomListView): Integer; override;
163    class function GetViewOrigin(const ALV: TCustomListView): TPoint; override;
164    class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override;
165
166    class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override;
167    class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
168    class procedure SetColor(const AWinControl: TWinControl); override;
169    class procedure SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer); override;
170    class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
171    class procedure SetHotTrackStyles(const ALV: TCustomListView; const AValue: TListHotTrackStyles); override;
172    class procedure SetHoverTime(const ALV: TCustomListView; const AValue: Integer); override;
173    class procedure SetIconArrangement(const ALV: TCustomListView; const AValue: TIconArrangement); override;
174    class procedure SetImageList(const ALV: TCustomListView; const AList: TListViewImageList; const AValue: TCustomImageListResolution); override;
175    class procedure SetItemsCount(const ALV: TCustomListView; const AValue: Integer); override;
176    class procedure SetOwnerData(const ALV: TCustomListView; const AValue: Boolean); override;
177    class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); override;
178    class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); override;
179    class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); override;
180    class procedure SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer;
181      const ASortDirection: TSortDirection); override;
182    class procedure SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint); override;
183    class procedure SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle); override;
184  end;
185
186  { TWinCEWSListView }
187
188  TWinCEWSListView = class(TWSListView)
189  private
190  protected
191  public
192  end;
193
194  { TWinCEWSProgressBar }
195
196  TWinCEWSProgressBar = class(TWSProgressBar)
197  published
198    class function  CreateHandle(const AWinControl: TWinControl;
199          const AParams: TCreateParams): HWND; override;
200    class procedure ApplyChanges(const AProgressBar: TCustomProgressBar); override;
201    class procedure SetPosition(const AProgressBar: TCustomProgressBar; const NewPosition: integer); override;
202  end;
203
204  { TWinCEWSCustomUpDown }
205
206  TWinCEWSCustomUpDown = class(TWSCustomUpDown)
207  private
208  protected
209  public
210  end;
211
212  { TWinCEWSUpDown }
213
214  TWinCEWSUpDown = class(TWSUpDown)
215  private
216  protected
217  public
218  end;
219
220  { TWinCEWSToolButton }
221
222  TWinCEWSToolButton = class(TWSToolButton)
223  private
224  protected
225  public
226  end;
227
228  { TWinCEWSToolBar }
229
230  TWinCEWSToolBar = class(TWSToolBar)
231  private
232  protected
233  public
234  end;
235
236  { TWinCEWSTrackBar }
237
238  TWinCEWSTrackBar = class(TWSTrackBar)
239  published
240    class function  CreateHandle(const AWinControl: TWinControl;
241          const AParams: TCreateParams): HWND; override;
242    class procedure ApplyChanges(const ATrackBar: TCustomTrackBar); override;
243    class function  GetPosition(const ATrackBar: TCustomTrackBar): integer; override;
244    class procedure SetPosition(const ATrackBar: TCustomTrackBar; const NewPosition: integer); override;
245  end;
246
247  { TWinCEWSCustomTreeView }
248
249  TWinCEWSCustomTreeView = class(TWSCustomTreeView)
250  private
251  protected
252  public
253  end;
254
255  { TWinCEWSTreeView }
256
257  TWinCEWSTreeView = class(TWSTreeView)
258  private
259  protected
260  public
261  end;
262
263
264procedure NotebookFocusNewControl(const ATabControl: TCustomTabControl; NewIndex: integer);
265function NotebookPageRealToLCLIndex(const ATabControl: TCustomTabControl; AIndex: integer): integer;
266
267implementation
268
269
270{$I wincepagecontrol.inc}
271{$I wincewscustomlistview.inc }
272
273
274{ --- Helper routines for TWinCEWSStatusBar --- }
275
276{------------------------------------------------------------------------------
277  Method: UpdateStatusBarPanel
278  Params: StatusPanel - StatusPanel which needs to be update
279  Returns: Nothing
280
281  Called by StatusBarPanelUpdate and StatusBarSetText
282  Everything is updated except the panel width
283 ------------------------------------------------------------------------------}
284procedure UpdateStatusBarPanel(const StatusPanel: TStatusPanel);
285var
286  BevelType: integer;
287  Text: string;
288begin
289  Text := StatusPanel.Text;
290  case StatusPanel.Alignment of
291    taCenter: Text := #9 + Text;
292    taRightJustify: Text := #9#9 + Text;
293  end;
294  case StatusPanel.Bevel of
295    pbNone: BevelType := Windows.SBT_NOBORDERS;
296    pbLowered: BevelType := 0;
297    pbRaised: BevelType := Windows.SBT_POPOUT;
298  end;
299  Windows.SendMessageW(StatusPanel.StatusBar.Handle, SB_SETTEXT,
300   StatusPanel.Index or BevelType, LPARAM(PWideChar(UTF8Decode(Text))));
301end;
302
303procedure UpdateStatusBarPanelWidths(const StatusBar: TStatusBar);
304var
305  Rights: PInteger;
306  PanelIndex: integer;
307  CurrentRight: integer;
308begin
309  if StatusBar.Panels.Count=0 then begin
310    // SETPARTS 0,0 does not work :S
311    Windows.SendMessageW(StatusBar.Handle, SB_SIMPLE, 1, 0);
312    Windows.SendMessageW(StatusBar.Handle, SB_SETTEXT, 255, WPARAM(PWideChar('')));
313    exit;
314  end;
315  Getmem(Rights, StatusBar.Panels.Count * sizeof(integer));
316  try
317    CurrentRight := 0;
318    for PanelIndex := 0 to StatusBar.Panels.Count-2 do begin
319      CurrentRight := CurrentRight + StatusBar.Panels[PanelIndex].Width;
320      Rights[PanelIndex] := CurrentRight;
321    end;
322    Rights[StatusBar.Panels.Count-1] := -1; //Last extends to end;
323    Windows.SendMessage(StatusBar.Handle, SB_SETPARTS, StatusBar.Panels.Count, LPARAM(Rights));
324  finally
325    Freemem(Rights);
326  end;
327end;
328
329{ TWinCEWSStatusBar }
330
331
332class function TWinCEWSStatusBar.CreateHandle(const AWinControl: TWinControl;
333  const AParams: TCreateParams): HWND;
334var
335  Params: TCreateWindowExParams;
336  init : TINITCOMMONCONTROLSEX;
337begin
338  init.dwSize := Sizeof(TINITCOMMONCONTROLSEX);
339  init.dwICC := ICC_BAR_CLASSES;
340  InitCommonControlsEx(@init);
341  // general initialization of Params
342  PrepareCreateWindow(AWinControl, AParams, Params);
343
344  // customization of Params
345  with Params do
346  begin
347    pClassName := STATUSCLASSNAME;
348    WindowTitle := StrCaption;
349    Left := LongInt(CW_USEDEFAULT);
350    Top := LongInt(CW_USEDEFAULT);
351    Width := LongInt(CW_USEDEFAULT);
352    Height := LongInt(CW_USEDEFAULT);
353  end;
354  // create window
355  FinishCreateWindow(AWinControl, Params, false);
356  // need to set handle for Update method
357  AWinControl.Handle := Params.Window;
358  Update(TStatusBar(AWinControl));
359  Result := Params.Window;
360end;
361
362class procedure TWinCEWSStatusBar.PanelUpdate(const AStatusBar: TStatusBar; PanelIndex: integer);
363begin
364  UpdateStatusBarPanelWidths(AStatusBar);
365  UpdateStatusBarPanel(AStatusBar.Panels[PanelIndex]);
366end;
367
368class procedure TWinCEWSStatusBar.SetBounds(const AWinControl: TWinControl;
369  const ALeft, ATop, AWidth, AHeight: integer);
370begin
371  // statusbars do their own resizing, post a size message to it's queue
372  Windows.PostMessage(AWinControl.Handle, WM_SIZE, 0, 0);
373end;
374
375class procedure TWinCEWSStatusBar.GetPreferredSize(const AWinControl: TWinControl;
376  var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
377var
378  R: TRect;
379begin
380  // statusbars cannot be resized by the LCL, so actual size is preferred size
381  if Windows.GetWindowRect(AWinControl.Handle, @R) then begin
382    PreferredHeight:= R.Bottom - R.Top;
383    PreferredWidth:= R.Right - R.Left;
384  end;
385end;
386
387class procedure TWinCEWSStatusBar.SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer);
388begin
389  if AStatusBar.SimplePanel then
390  begin
391    Windows.SendMessageW(AStatusBar.Handle, SB_SETTEXT, 255,
392      LPARAM(PWideChar(UTF8Decode(AStatusBar.SimpleText))));
393  end
394  else
395    UpdateStatusBarPanel(AStatusBar.Panels[PanelIndex]);
396end;
397
398class procedure TWinCEWSStatusBar.SetText(const AWinControl: TWinControl;
399  const AText: string);
400begin
401  // inhibit. StatusBars do not have a caption, simpletext is set by SetPanelText
402end;
403
404class procedure TWinCEWSStatusBar.Update(const AStatusBar: TStatusBar);
405var
406  PanelIndex: integer;
407begin
408  Windows.SendMessage(AStatusBar.Handle, SB_SIMPLE, WPARAM(AStatusBar.SimplePanel), 0);
409  if AStatusBar.SimplePanel then
410    SetPanelText(AStatusBar, 0)
411  else begin
412    UpdateStatusBarPanelWidths(AStatusBar);
413    for PanelIndex := 0 to AStatusBar.Panels.Count-1 do
414      UpdateStatusBarPanel(AStatusBar.Panels[PanelIndex]);
415  end;
416end;
417
418{ TWinCEWSProgressBar }
419
420class function TWinCEWSProgressBar.CreateHandle(const AWinControl: TWinControl;
421  const AParams: TCreateParams): HWND;
422var
423  Params: TCreateWindowExParams;
424  init : TINITCOMMONCONTROLSEX;
425begin
426  init.dwSize := Sizeof(TINITCOMMONCONTROLSEX);
427  init.dwICC := ICC_PROGRESS_CLASS;
428  InitCommonControlsEx(@init);
429  // general initialization of Params
430  PrepareCreateWindow(AWinControl, AParams, Params);
431  // customization of Params
432  with Params do
433  begin
434    with TCustomProgressBar(AWinControl) do
435    begin
436      if Smooth then
437        Flags := Flags or PBS_SMOOTH;
438      if (Orientation = pbVertical) or (Orientation = pbTopDown) then
439        Flags := Flags or PBS_VERTICAL;
440    end;
441    pClassName := PROGRESS_CLASS;
442  end;
443  // create window
444  FinishCreateWindow(AWinControl, Params, false);
445  Result := Params.Window;
446end;
447
448class procedure TWinCEWSProgressBar.ApplyChanges(
449  const AProgressBar: TCustomProgressBar);
450begin
451  with AProgressBar do
452  begin
453    { smooth and vertical need window recreation }
454    if ((GetWindowLong(Handle, GWL_STYLE) and PBS_SMOOTH  ) <>
455         Integer(Smooth) * PBS_SMOOTH) or
456       ((GetWindowLong(Handle, GWL_STYLE) and PBS_VERTICAL) <>
457         Integer((Orientation = pbVertical) or (Orientation = pbTopDown)) * PBS_VERTICAL) then
458      RecreateWnd(AProgressBar);
459
460    SendMessage(Handle, PBM_SETRANGE32, Min, Max);
461    SendMessage(Handle, PBM_SETPOS, Position, 0);
462
463{ TODO: Implementable?
464    If BarShowText Then
465    Begin
466      SetWindowText(Handle, StrToPChar((Sender As TControl).Caption));
467    End
468    Else
469      SetWindowText(Handle, Nil);
470}
471  end;
472end;
473
474class procedure TWinCEWSProgressBar.SetPosition(
475  const AProgressBar: TCustomProgressBar; const NewPosition: integer);
476begin
477  Windows.SendMessage(AProgressBar.Handle, PBM_SETPOS, Windows.WPARAM(NewPosition), 0);
478end;
479
480{ TWinCEWSTrackBar }
481
482class function TWinCEWSTrackBar.CreateHandle(const AWinControl: TWinControl;
483  const AParams: TCreateParams): HWND;
484var
485  Params: TCreateWindowExParams;
486  init : TINITCOMMONCONTROLSEX;
487begin
488  init.dwSize := Sizeof(TINITCOMMONCONTROLSEX);
489  init.dwICC := ICC_BAR_CLASSES;
490  InitCommonControlsEx(@init);
491  // general initialization of Params
492  PrepareCreateWindow(AWinControl, AParams, Params);
493  // customization of Params
494  with Params do
495  begin
496    pClassName := TRACKBAR_CLASS;
497    WindowTitle := StrCaption;
498  end;
499  // create window
500  FinishCreateWindow(AWinControl, Params, false);
501  Result := Params.Window;
502end;
503
504class procedure TWinCEWSTrackBar.ApplyChanges(const ATrackBar: TCustomTrackBar);
505var
506  wHandle: HWND;
507  NewStyle: integer;
508const
509  StyleMask = TBS_AUTOTICKS or TBS_NOTICKS or TBS_VERT or TBS_TOP or TBS_BOTH;
510  TickStyleStyle : array[TTickStyle] of integer =
511    (TBS_NOTICKS, TBS_AUTOTICKS, 0);
512  OrientationStyle : array[TTrackBarOrientation] of integer =
513    (TBS_HORZ, TBS_VERT);
514  TickMarksStyle : array[TTickMark] of integer =
515    (TBS_BOTTOM, TBS_TOP, TBS_BOTH);
516begin
517  with ATrackBar do
518  begin
519    { cache handle }
520    wHandle := Handle;
521    NewStyle := TickStyleStyle[TickStyle] or OrientationStyle[Orientation] or
522                TickMarksStyle[TickMarks];
523    UpdateWindowStyle(wHandle, NewStyle, StyleMask);
524    Windows.SendMessage(wHandle, TBM_SETRANGEMAX, Windows.WPARAM(true), Max);
525    Windows.SendMessage(wHandle, TBM_SETRANGEMIN, Windows.WPARAM(true), Min);
526    Windows.SendMessage(wHandle, TBM_SETPOS, Windows.WPARAM(true), Position);
527    Windows.SendMessage(wHandle, TBM_SETLINESIZE, 0, LineSize);
528    Windows.SendMessage(wHandle, TBM_SETPAGESIZE, 0, PageSize);
529    Windows.SendMessage(wHandle, TBM_SETTICFREQ, Frequency, 0);
530  end;
531end;
532
533class function  TWinCEWSTrackBar.GetPosition(const ATrackBar: TCustomTrackBar): integer;
534begin
535  Result := SendMessage(ATrackBar.Handle, TBM_GETPOS, 0, 0)
536end;
537
538class procedure TWinCEWSTrackBar.SetPosition(const ATrackBar: TCustomTrackBar; const NewPosition: integer);
539begin
540  Windows.SendMessage(ATrackBar.Handle, TBM_SETPOS, Windows.WPARAM(true), Windows.LPARAM(NewPosition));
541end;
542
543end.
544