mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-07 18:18:30 +02:00
T(Float)SpinEdit: make Modified have the correct value in OnChange as well.
This commit is contained in:
parent
16c42ceaa0
commit
2befd9dd7f
@ -32,6 +32,17 @@ begin
|
||||
RegisterCustomFloatSpinEdit;
|
||||
end;
|
||||
|
||||
procedure TCustomFloatSpinEdit.Change;
|
||||
begin
|
||||
//This needs to be done here, not in TextChanged, since the WS causes a Change, but not a TextChanged.
|
||||
if FForceModifiedIsFalseInOnChange then
|
||||
begin
|
||||
Modified := False;
|
||||
FForceModifiedIsFalseInOnChange := False;
|
||||
end;
|
||||
inherited Change;
|
||||
end;
|
||||
|
||||
function TCustomFloatSpinEdit.RealGetText: TCaption;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
@ -140,9 +151,12 @@ begin
|
||||
// clear FValueChanged to prevent getting the old value from the widget
|
||||
FValueChanged := False;
|
||||
FUpdatePending := True;
|
||||
UpdateControl;
|
||||
|
||||
Modified := False;
|
||||
//UpdateControl will trigger an OnChange through the WS code
|
||||
//Modified will no be reset to True by the WS code, but in this case we need it to be False
|
||||
if not (csLoading in ComponentState) then
|
||||
FForceModifiedIsFalseInOnChange := True;
|
||||
UpdateControl;
|
||||
|
||||
if not HandleAllocated
|
||||
and ([csLoading, csDestroying] * ComponentState = [])
|
||||
@ -188,6 +202,7 @@ begin
|
||||
inherited Create(TheOwner);
|
||||
FCompStyle := csSpinEdit;
|
||||
|
||||
FForceModifiedIsFalseInOnChange := False;
|
||||
FIncrement := DefIncrement;
|
||||
FDecimals := DefDecimals;
|
||||
FMaxValue := DefMaxValue;
|
||||
|
@ -40,6 +40,7 @@ type
|
||||
FEditorEnabled: Boolean;
|
||||
FMaxValue: Double;
|
||||
FMinValue: Double;
|
||||
FForceModifiedIsFalseInOnChange: Boolean;
|
||||
FValue: Double;
|
||||
FValueEmpty: Boolean;
|
||||
FUpdatePending: Boolean;
|
||||
@ -51,6 +52,7 @@ type
|
||||
function IncrementStored: Boolean;
|
||||
protected
|
||||
class procedure WSRegisterClass; override;
|
||||
procedure Change; override;
|
||||
function RealGetText: TCaption; override;
|
||||
procedure RealSetText(const AValue: TCaption); override;
|
||||
procedure TextChanged; override;
|
||||
|
Loading…
Reference in New Issue
Block a user