Bug fix for Mattias.

Fixed spinedit so you can now get the value and set the value.
Shane

git-svn-id: trunk@687 -
This commit is contained in:
lazarus 2002-02-09 01:45:14 +00:00
parent bdf8fb50ca
commit 33ed59075b
3 changed files with 58 additions and 35 deletions

View File

@ -1,30 +1,34 @@
// included by spin.pp
{-----------------------------------------------------------------------------}
procedure TSpinEdit.UpdateControl;
begin
CNSendMessage(LM_SetProperties,self,nil);
end;
{-----------------------------------------------------------------------------}
procedure TSpinEdit.SetClimbRate(Num : Single);
begin
fClimbRate := Num;
// ******************************
// the following line has been commented out so that gtk dependency can be
// removed from all files. The following function needs to be moved. MAH
//
// PgtkSpinButton(fComponent)^.Climb_rate := fCLimbRate;
UpdateControl;
end;
{-----------------------------------------------------------------------------}
Procedure TSpinEdit.SetValue(num : Single);
begin
FValue := Num;
// ******************************
// the following line has been commented out so that gtk dependency can be
// removed from all files. The following function needs to be moved. MAH
//
// gtk_spin_button_set_value(PgtkSpinButton(fComponent),FValue);
UpdateControl;
end;
{-----------------------------------------------------------------------------}
Function TSpinEdit.GetValue : Single;
Var
Temp : Real;
begin
CNSendMessage(LM_GETVALUE,Self,@Temp);
FValue := Temp;
getvalue := fValue;
end;
@ -32,6 +36,7 @@ end;
procedure TSpinEdit.SetDecimals(Num : Integer);
begin
fDecimals := Num;
UpdateControl;
end;
{-----------------------------------------------------------------------------}

View File

@ -2975,6 +2975,12 @@ begin
end;
csSpinEdit : Begin
Single(Data^) := gtk_spin_button_get_value_As_Float(PgtkSpinButton(Handle));
end;
else
Assert (true, Format ('WARNING:[TgtkObject.GetValue] failed for %s', [Sender.ClassName]));
end;
@ -3324,6 +3330,13 @@ begin
then TWinControl(sender).Handle := THandle(gtk_image_new(Image,nil))
else gtk_image_set(PgtkImage(handle),Image,nil);
end;
csSpinEdit:
Begin
gtk_spin_button_set_digits(PgtkSpinButton(Widget),TSpinEdit(Sender).Decimal_Places);
gtk_spin_button_set_value(PgtkSpinButton(Widget),TSpinEdit(Sender).Value);
End;
else
Assert (true, Format ('WARNING:[TgtkObject.SetProperties] failed for %s', [Sender.ClassName]));
end;
@ -3791,6 +3804,11 @@ end;
{ =============================================================================
$Log$
Revision 1.109 2002/03/14 20:28:49 lazarus
Bug fix for Mattias.
Fixed spinedit so you can now get the value and set the value.
Shane
Revision 1.108 2002/03/13 22:48:16 lazarus
Constraints implementation (first cut) and sizig - moving system rework to
better match Delphi/Kylix way of doing things (the existing implementation

View File

@ -25,35 +25,35 @@ unit spin;
interface
uses classes,controls,sysutils, stdCtrls,vclGlobals;
uses classes,controls,sysutils, stdCtrls,vclGlobals,LMessages;
type
TSpinEdit = class(TWinControl)
private
fdecimals : Integer;
fValue : Single;
fClimbRate : Single;
TSpinEdit = class(TWinControl)
private
fdecimals : Integer;
fValue : Single;
fClimbRate : Single;
Procedure UpdateControl;
protected
procedure SetDecimals(num : Integer);
Function GetValue : Single;
procedure SetValue(Num : Single);
procedure SetClimbRate(num : Single);
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
published
property Align;
property Decimal_Places : Integer read fDecimals write SetDecimals;
property Enabled;
property Value : Single read GetValue write SetValue;
property Climb_Rate : Single read fClimbRate write SetClimbRate;
property Visible;
property OnEnter;
property OnExit;
property PopupMenu;
property ShowHint;
procedure SetDecimals(num : Integer);
Function GetValue : Single;
procedure SetValue(Num : Single);
procedure SetClimbRate(num : Single);
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
published
property Align;
property Decimal_Places : Integer read fDecimals write SetDecimals;
property Enabled;
property Value : Single read GetValue write SetValue;
property Climb_Rate : Single read fClimbRate write SetClimbRate;
property Visible;
property OnEnter;
property OnExit;
property PopupMenu;
property ShowHint;
end;
Implementation