diff --git a/lcl/include/spinedit.inc b/lcl/include/spinedit.inc index a02d5cc18b..6a179f0359 100644 --- a/lcl/include/spinedit.inc +++ b/lcl/include/spinedit.inc @@ -47,10 +47,15 @@ var begin PrevValue := FValue; FValueChanged := True; - - if Value <> PrevValue then FValueEmpty := False; - - inherited; + + DebugLn('TCustomFloatSpinEdit.TextChanged Text: ' + Text + ' Value: ' + DbgS(Value)); + + if Value <> PrevValue then + begin + FValueEmpty := False; + + inherited; + end; end; procedure TCustomFloatSpinEdit.SetMaxValue(const AValue: Single); @@ -144,13 +149,6 @@ begin SetInitialBounds(0, 0, 50, 23); end; -procedure TCustomFloatSpinEdit.EditingDone; -begin - Text := ValueToStr(FValue); - - inherited EditingDone; -end; - function TCustomFloatSpinEdit.GetLimitedValue(const AValue: Single): Single; begin Result := AValue; diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index d296937222..4760fd2f1b 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -3380,6 +3380,11 @@ begin ConnectSenderSignal(gCore, 'changed', @gtkchanged_editbox) else if ALCLObject is TCustomCheckbox then ConnectSenderSignal(gObject, 'toggled', @gtktoggledCB) + {$IFDEF GTK2} + // in gtk2 callback signal of SpinEdit is 'value-changed' (in gtk1- 'changed') + else if ALCLObject is TCustomFloatSpinEdit then + ConnectSenderSignal(gObject, 'value-changed', @gtkchanged_editbox) + {$ENDIF} else ConnectSenderSignal(gObject, 'changed', @gtkchanged_editbox); end; diff --git a/lcl/interfaces/gtk/gtkwsspin.pp b/lcl/interfaces/gtk/gtkwsspin.pp index 4189ef9d2e..ef74838698 100644 --- a/lcl/interfaces/gtk/gtkwsspin.pp +++ b/lcl/interfaces/gtk/gtkwsspin.pp @@ -98,8 +98,13 @@ end; class function TGtkWSCustomFloatSpinEdit.GetValue( const ACustomFloatSpinEdit: TCustomFloatSpinEdit): single; begin - Result:=gtk_spin_button_get_value_as_float( - PGtkSpinButton(ACustomFloatSpinEdit.Handle)); +{$IFDEF GTK2} + // developer.gnome.org/doc/API/2.2/gtk/GtkSpinButton.html: + // "function gtk_spin_button_get_value_as_float is deprecated, use gtk_spin_button_get_value() instead" + Result:=Single(gtk_spin_button_get_value(PGtkSpinButton(ACustomFloatSpinEdit.Handle))); +{$ELSE} + Result:=gtk_spin_button_get_value_as_float(PGtkSpinButton(ACustomFloatSpinEdit.Handle)); +{$ENDIF} end; class procedure TGtkWSCustomFloatSpinEdit.SetSelStart(const ACustomEdit: TCustomEdit; diff --git a/lcl/spin.pp b/lcl/spin.pp index 8e2904d502..88d15aedfa 100644 --- a/lcl/spin.pp +++ b/lcl/spin.pp @@ -30,7 +30,7 @@ unit Spin; interface uses - Classes, Controls, SysUtils, LCLType, LMessages, ClipBrd, StdCtrls; + Classes, Controls, SysUtils, LCLType, LCLProc, LMessages, ClipBrd, StdCtrls; type { TCustomFloatSpinEdit } @@ -62,7 +62,6 @@ type procedure Loaded; override; public constructor Create(TheOwner: TComponent); override; - procedure EditingDone; override; function GetLimitedValue(const AValue: Single): Single; function ValueToStr(const AValue: Single): String; function StrToValue(const S: String): Single;