mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 14:11:32 +02:00
implemented several TrackBar properties on win32 (issue #1795)
git-svn-id: trunk@9115 -
This commit is contained in:
parent
01de1692b1
commit
db2a2141a9
@ -1498,7 +1498,7 @@ type
|
|||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure SetTick(Value: Integer);
|
procedure SetTick(Value: Integer);
|
||||||
published
|
published
|
||||||
property Frequency: Integer read FFrequency write SetFrequency;
|
property Frequency: Integer read FFrequency write SetFrequency default 1;
|
||||||
property LineSize: Integer read FLineSize write SetLineSize default 1;
|
property LineSize: Integer read FLineSize write SetLineSize default 1;
|
||||||
property Max: Integer read FMax write SetMax default 10;
|
property Max: Integer read FMax write SetMax default 10;
|
||||||
property Min: Integer read FMin write SetMin default 0;
|
property Min: Integer read FMin write SetMin default 0;
|
||||||
|
@ -68,6 +68,7 @@ begin
|
|||||||
FMin := 0;
|
FMin := 0;
|
||||||
FPosition := 0;
|
FPosition := 0;
|
||||||
FPageSize := 2;
|
FPageSize := 2;
|
||||||
|
FFrequency := 1;
|
||||||
FOrientation := trHorizontal;
|
FOrientation := trHorizontal;
|
||||||
FScalePos := trTop;
|
FScalePos := trTop;
|
||||||
FScaleDigits := 0;
|
FScaleDigits := 0;
|
||||||
@ -200,7 +201,11 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomTrackBar.SetFrequency(Value: Integer);
|
procedure TCustomTrackBar.SetFrequency(Value: Integer);
|
||||||
begin
|
begin
|
||||||
FFrequency := Value;
|
if FFrequency <> Value then
|
||||||
|
begin
|
||||||
|
FFrequency := Value;
|
||||||
|
ApplyChanges;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -226,7 +231,11 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomTrackBar.SetTickMarks(Value: TTickMark);
|
procedure TCustomTrackBar.SetTickMarks(Value: TTickMark);
|
||||||
begin
|
begin
|
||||||
FTickMarks := Value;
|
if FTickMarks <> Value then
|
||||||
|
begin
|
||||||
|
FTickMarks := Value;
|
||||||
|
ApplyChanges;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -32,11 +32,11 @@ uses
|
|||||||
// LCL
|
// LCL
|
||||||
ComCtrls, LCLType, Controls, Graphics,
|
ComCtrls, LCLType, Controls, Graphics,
|
||||||
ImgList, StdCtrls,
|
ImgList, StdCtrls,
|
||||||
LCLProc, InterfaceBase, Win32Int,
|
LCLProc, InterfaceBase,
|
||||||
// widgetset
|
// widgetset
|
||||||
WSComCtrls, WSLCLClasses, WSProc,
|
WSComCtrls, WSLCLClasses, WSProc,
|
||||||
// win32 widgetset
|
// win32 widgetset
|
||||||
Win32WSControls;
|
Win32Int, Win32Proc, Win32WSControls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -525,35 +525,29 @@ end;
|
|||||||
procedure TWin32WSTrackBar.ApplyChanges(const ATrackBar: TCustomTrackBar);
|
procedure TWin32WSTrackBar.ApplyChanges(const ATrackBar: TCustomTrackBar);
|
||||||
var
|
var
|
||||||
wHandle: HWND;
|
wHandle: HWND;
|
||||||
|
NewStyle: integer;
|
||||||
|
const
|
||||||
|
StyleMask = TBS_AUTOTICKS or TBS_NOTICKS or TBS_VERT or TBS_TOP or TBS_BOTH;
|
||||||
|
TickStyleStyle : array[TTickStyle] of integer =
|
||||||
|
(TBS_NOTICKS, TBS_AUTOTICKS, 0);
|
||||||
|
OrientationStyle : array[TTrackBarOrientation] of integer =
|
||||||
|
(TBS_HORZ, TBS_VERT);
|
||||||
|
TickMarksStyle : array[TTickMark] of integer =
|
||||||
|
(TBS_BOTTOM, TBS_TOP, TBS_BOTH);
|
||||||
begin
|
begin
|
||||||
with ATrackBar do
|
with ATrackBar do
|
||||||
begin
|
begin
|
||||||
{ cache handle }
|
{ cache handle }
|
||||||
wHandle := Handle;
|
wHandle := Handle;
|
||||||
|
NewStyle := TickStyleStyle[TickStyle] or OrientationStyle[Orientation] or
|
||||||
|
TickMarksStyle[TickMarks];
|
||||||
|
UpdateWindowStyle(wHandle, NewStyle, StyleMask);
|
||||||
Windows.SendMessage(wHandle, TBM_SETRANGEMAX, Windows.WPARAM(true), Max);
|
Windows.SendMessage(wHandle, TBM_SETRANGEMAX, Windows.WPARAM(true), Max);
|
||||||
Windows.SendMessage(wHandle, TBM_SETRANGEMIN, Windows.WPARAM(true), Min);
|
Windows.SendMessage(wHandle, TBM_SETRANGEMIN, Windows.WPARAM(true), Min);
|
||||||
Windows.SendMessage(wHandle, TBM_SETPOS, Windows.WPARAM(true), Position);
|
Windows.SendMessage(wHandle, TBM_SETPOS, Windows.WPARAM(true), Position);
|
||||||
Windows.SendMessage(wHandle, TBM_SETLINESIZE, 0, LineSize);
|
Windows.SendMessage(wHandle, TBM_SETLINESIZE, 0, LineSize);
|
||||||
Windows.SendMessage(wHandle, TBM_SETPAGESIZE, 0, PageSize);
|
Windows.SendMessage(wHandle, TBM_SETPAGESIZE, 0, PageSize);
|
||||||
case Orientation of
|
Windows.SendMessage(wHandle, TBM_SETTICFREQ, Frequency, 0);
|
||||||
trVertical:
|
|
||||||
SetWindowLong(wHandle, GWL_STYLE, GetWindowLong(wHandle, GWL_STYLE) or TBS_VERT);
|
|
||||||
trHorizontal:
|
|
||||||
SetWindowLong(wHandle, GWL_STYLE, GetWindowLong(wHandle, GWL_STYLE) or TBS_HORZ);
|
|
||||||
end;
|
|
||||||
if TickStyle<>tsNone then
|
|
||||||
begin
|
|
||||||
case ScalePos of
|
|
||||||
trLeft:
|
|
||||||
SetWindowLong(wHandle, GWL_STYLE, GetWindowLong(wHandle, GWL_STYLE) or TBS_LEFT or TBS_VERT);
|
|
||||||
trRight:
|
|
||||||
SetWindowLong(wHandle, GWL_STYLE, GetWindowLong(wHandle, GWL_STYLE) or TBS_RIGHT or TBS_VERT);
|
|
||||||
trTop:
|
|
||||||
SetWindowLong(wHandle, GWL_STYLE, GetWindowLong(wHandle, GWL_STYLE) or TBS_TOP or TBS_HORZ);
|
|
||||||
trBottom:
|
|
||||||
SetWindowLong(wHandle, GWL_STYLE, GetWindowLong(wHandle, GWL_STYLE) or TBS_BOTTOM or TBS_HORZ);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user