mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-16 03:20:33 +01:00
MG: fixed unallocated spinedit handle bug
git-svn-id: trunk@3243 -
This commit is contained in:
parent
6670f3b92c
commit
60de83b33e
@ -19,21 +19,26 @@
|
||||
{-----------------------------------------------------------------------------}
|
||||
procedure TSpinEdit.UpdateControl;
|
||||
begin
|
||||
CNSendMessage(LM_SetProperties,self,nil);
|
||||
if not HandleAllocated then exit;
|
||||
CNSendMessage(LM_SetProperties,Self,nil);
|
||||
fValueNeedsUpdate:=false;
|
||||
end;
|
||||
|
||||
{-----------------------------------------------------------------------------}
|
||||
procedure TSpinEdit.SetClimbRate(Num : Single);
|
||||
begin
|
||||
fClimbRate := Num;
|
||||
UpdateControl;
|
||||
if fClimbRate = Num then exit;
|
||||
fClimbRate := Num;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
{-----------------------------------------------------------------------------}
|
||||
Procedure TSpinEdit.SetValue(num : Single);
|
||||
begin
|
||||
FValue := Num;
|
||||
UpdateControl;
|
||||
if FValue = Num then exit;
|
||||
FValue := Num;
|
||||
fValueNeedsUpdate:=true;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
{-----------------------------------------------------------------------------}
|
||||
@ -41,30 +46,33 @@ Function TSpinEdit.GetValue : Single;
|
||||
Var
|
||||
Temp : Real;
|
||||
begin
|
||||
CNSendMessage(LM_GETVALUE,Self,@Temp);
|
||||
FValue := Temp;
|
||||
getvalue := fValue;
|
||||
if HandleAllocated and (not fValueNeedsUpdate) then begin
|
||||
CNSendMessage(LM_GETVALUE,Self,@Temp);
|
||||
FValue := Temp;
|
||||
end;
|
||||
GetValue := fValue;
|
||||
end;
|
||||
|
||||
{-----------------------------------------------------------------------------}
|
||||
procedure TSpinEdit.SetDecimals(Num : Integer);
|
||||
begin
|
||||
fDecimals := Num;
|
||||
UpdateControl;
|
||||
if fDecimals = Num then exit;
|
||||
fDecimals := Num;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
{-----------------------------------------------------------------------------}
|
||||
constructor TSpinEdit.Create(AOwner : TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
fCompStyle := csSpinEdit;
|
||||
inherited Create(AOwner);
|
||||
fCompStyle := csSpinEdit;
|
||||
|
||||
fClimbRate := 1;
|
||||
fDecimals := 2;
|
||||
fValue := 1;
|
||||
|
||||
setbounds(1,1,50,20);
|
||||
fClimbRate := 1;
|
||||
fDecimals := 2;
|
||||
fValue := 1;
|
||||
fValueNeedsUpdate := true;
|
||||
|
||||
SetBounds(1,1,50,20);
|
||||
end;
|
||||
|
||||
{-----------------------------------------------------------------------------}
|
||||
@ -72,3 +80,6 @@ destructor TSpinEdit.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
// included by spin.pp
|
||||
|
||||
|
||||
@ -36,11 +36,12 @@ uses
|
||||
type
|
||||
TSpinEdit = class(TWinControl)
|
||||
private
|
||||
fdecimals : Integer;
|
||||
fDecimals : Integer;
|
||||
fValue : Single;
|
||||
fClimbRate : Single;
|
||||
fValueNeedsUpdate: boolean;
|
||||
Procedure UpdateControl;
|
||||
protected
|
||||
protected
|
||||
procedure SetDecimals(num : Integer);
|
||||
Function GetValue : Single;
|
||||
procedure SetValue(Num : Single);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user