mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:19:19 +02:00
T(Float)SpinEdit: implement property EditorEnabled. ATM win32/64 and wince only. Issue #0038736.
git-svn-id: trunk@64989 -
This commit is contained in:
parent
dcb4b22eef
commit
a148676b51
@ -160,6 +160,16 @@ begin
|
||||
Result := FValue;
|
||||
end;
|
||||
|
||||
procedure TCustomFloatSpinEdit.SetEditorEnabled(AValue: Boolean);
|
||||
begin
|
||||
if FEditorEnabled <> AValue then
|
||||
begin
|
||||
FEditorEnabled := AValue;
|
||||
if HandleAllocated then
|
||||
TWSCustomFloatSpinEditClass(WidgetSetClass).SetEditorEnabled(Self, AValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomFloatSpinEdit.IncrementStored: Boolean;
|
||||
begin
|
||||
Result := not SameValue(FIncrement, DefIncrement);
|
||||
@ -182,6 +192,7 @@ begin
|
||||
FMaxValue := DefMaxValue;
|
||||
FUpdatePending := True;
|
||||
FValueChanged := True;
|
||||
FEditorEnabled := True;
|
||||
|
||||
with GetControlClassDefaultSize do
|
||||
SetInitialBounds(0, 0, CX, CY);
|
||||
|
@ -65,6 +65,8 @@ type
|
||||
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||
|
||||
class procedure SetEditorEnabled(const ACustomFloatSpinEdit: TCustomFloatSpinEdit; AValue: Boolean); override;
|
||||
|
||||
class procedure UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit); override;
|
||||
end;
|
||||
|
||||
@ -429,6 +431,22 @@ begin
|
||||
SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or VisibilityToFlag[AWinControl.HandleObjectShouldBeVisible]);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomFloatSpinEdit.SetEditorEnabled(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit; AValue: Boolean);
|
||||
begin
|
||||
if not AValue then
|
||||
begin
|
||||
//make the Edit readonly, without setting the property ReadOnly to True
|
||||
if not ACustomFloatSpinEdit.ReadOnly then
|
||||
Windows.SendMessage(ACustomFloatSpinEdit.Handle, EM_SETREADONLY, Windows.WPARAM(True), 0);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if not ACustomFloatSpinEdit.ReadOnly then
|
||||
Windows.SendMessage(ACustomFloatSpinEdit.Handle, EM_SETREADONLY, Windows.WPARAM(False), 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomFloatSpinEdit.UpdateControl(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit);
|
||||
begin
|
||||
|
@ -50,6 +50,8 @@ type
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
|
||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||
|
||||
class procedure SetEditorEnabled(const ACustomFloatSpinEdit: TCustomFloatSpinEdit; AValue: Boolean); override;
|
||||
|
||||
class procedure UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit); override;
|
||||
end;
|
||||
|
||||
@ -255,6 +257,22 @@ begin
|
||||
ShowWindow(Buddy, SW_HIDE);
|
||||
end;
|
||||
|
||||
class procedure TWinCEWSCustomFloatSpinEdit.SetEditorEnabled(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit; AValue: Boolean);
|
||||
begin
|
||||
if not AValue then
|
||||
begin
|
||||
//make the Edit readonly, without setting the property ReadOnly to True
|
||||
if not ACustomFloatSpinEdit.ReadOnly then
|
||||
Windows.SendMessage(ACustomFloatSpinEdit.Handle, EM_SETREADONLY, Windows.WPARAM(True), 0);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if not ACustomFloatSpinEdit.ReadOnly then
|
||||
Windows.SendMessage(ACustomFloatSpinEdit.Handle, EM_SETREADONLY, Windows.WPARAM(False), 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TWinCEWSCustomFloatSpinEdit.UpdateControl(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit);
|
||||
begin
|
||||
|
@ -37,6 +37,7 @@ type
|
||||
private
|
||||
FIncrement: Double;
|
||||
FDecimals: Integer;
|
||||
FEditorEnabled: Boolean;
|
||||
FMaxValue: Double;
|
||||
FMinValue: Double;
|
||||
FValue: Double;
|
||||
@ -44,6 +45,7 @@ type
|
||||
FUpdatePending: Boolean;
|
||||
FValueChanged: Boolean;
|
||||
function GetValue: Double;
|
||||
procedure SetEditorEnabled(AValue: Boolean);
|
||||
procedure UpdateControl;
|
||||
function MaxValueStored: Boolean;
|
||||
function IncrementStored: Boolean;
|
||||
@ -70,6 +72,7 @@ type
|
||||
function StrToValue(const S: String): Double; virtual;
|
||||
public
|
||||
property DecimalPlaces: Integer read FDecimals write SetDecimals default DefDecimals;
|
||||
property EditorEnabled: Boolean read FEditorEnabled write SetEditorEnabled default True;
|
||||
property Increment: Double read FIncrement write SetIncrement stored IncrementStored nodefault;
|
||||
property MinValue: Double read FMinValue write SetMinValue;
|
||||
property MaxValue: Double read FMaxValue write SetMaxValue stored MaxValueStored nodefault;
|
||||
@ -92,6 +95,7 @@ type
|
||||
property Color;
|
||||
property Constraints;
|
||||
property DecimalPlaces;
|
||||
property EditorEnabled;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property Increment;
|
||||
@ -170,6 +174,7 @@ type
|
||||
property BorderSpacing;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property EditorEnabled;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property Increment;
|
||||
|
@ -58,6 +58,7 @@ type
|
||||
*)
|
||||
|
||||
class procedure UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit); virtual;
|
||||
class procedure SetEditorEnabled(const ACustomFloatSpinEdit: TCustomFloatSpinEdit; AValue: Boolean); virtual;
|
||||
end;
|
||||
TWSCustomFloatSpinEditClass = class of TWSCustomFloatSpinEdit;
|
||||
|
||||
@ -78,6 +79,11 @@ class procedure TWSCustomFloatSpinEdit.UpdateControl(const ACustomFloatSpinEdit:
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSCustomFloatSpinEdit.SetEditorEnabled(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit; AValue: Boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
{ WidgetSetRegistration }
|
||||
|
||||
procedure RegisterCustomFloatSpinEdit;
|
||||
|
Loading…
Reference in New Issue
Block a user