mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 22:59:15 +02:00
cocoa: fix controls leaking spinedit
git-svn-id: trunk@59235 -
This commit is contained in:
parent
465a09fb02
commit
5738bbf955
@ -325,7 +325,8 @@ type
|
|||||||
procedure dealloc; override;
|
procedure dealloc; override;
|
||||||
function updateStepper: boolean; message 'updateStepper';
|
function updateStepper: boolean; message 'updateStepper';
|
||||||
procedure UpdateControl(min, max, inc, avalue: double; ADecimalPlaces: Integer); message 'UpdateControl:::::';
|
procedure UpdateControl(min, max, inc, avalue: double; ADecimalPlaces: Integer); message 'UpdateControl:::::';
|
||||||
procedure CreateSubcontrols(const AParams: TCreateParams); message 'CreateSubControls:';
|
procedure lclCreateSubcontrols(const AParams: TCreateParams); message 'lclCreateSubControls:';
|
||||||
|
procedure lclReleaseSubcontrols; message 'lclReleaseSubcontrols';
|
||||||
procedure PositionSubcontrols(const ALeft, ATop, AWidth, AHeight: Integer); message 'PositionSubcontrols:ATop:AWidth:AHeight:';
|
procedure PositionSubcontrols(const ALeft, ATop, AWidth, AHeight: Integer); message 'PositionSubcontrols:ATop:AWidth:AHeight:';
|
||||||
procedure StepperChanged(sender: NSObject); message 'StepperChanged:';
|
procedure StepperChanged(sender: NSObject); message 'StepperChanged:';
|
||||||
procedure textDidEndEditing(notification: NSNotification); message 'textDidEndEditing:'; override;
|
procedure textDidEndEditing(notification: NSNotification); message 'textDidEndEditing:'; override;
|
||||||
@ -1524,11 +1525,7 @@ end;
|
|||||||
|
|
||||||
procedure TCocoaSpinEdit.dealloc;
|
procedure TCocoaSpinEdit.dealloc;
|
||||||
begin
|
begin
|
||||||
if Stepper <> nil then
|
lclReleaseSubControls;
|
||||||
Stepper.release;
|
|
||||||
if NumberFormatter <> nil then
|
|
||||||
NumberFormatter.release;
|
|
||||||
|
|
||||||
inherited dealloc;
|
inherited dealloc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1574,7 +1571,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCocoaSpinEdit.CreateSubcontrols(const AParams: TCreateParams);
|
procedure TCocoaSpinEdit.lclCreateSubcontrols(const AParams: TCreateParams);
|
||||||
var
|
var
|
||||||
lParams: TCreateParams;
|
lParams: TCreateParams;
|
||||||
begin
|
begin
|
||||||
@ -1621,6 +1618,21 @@ begin
|
|||||||
setFormatter(NumberFormatter);}
|
setFormatter(NumberFormatter);}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCocoaSpinEdit.lclReleaseSubcontrols;
|
||||||
|
begin
|
||||||
|
if Assigned(Stepper) then
|
||||||
|
begin
|
||||||
|
Stepper.removeFromSuperview;
|
||||||
|
Stepper.release;
|
||||||
|
Stepper := nil;
|
||||||
|
end;
|
||||||
|
if Assigned(NumberFormatter) then
|
||||||
|
begin
|
||||||
|
NumberFormatter.release;
|
||||||
|
NumberFormatter := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCocoaSpinEdit.PositionSubcontrols(const ALeft, ATop, AWidth, AHeight: Integer);
|
procedure TCocoaSpinEdit.PositionSubcontrols(const ALeft, ATop, AWidth, AHeight: Integer);
|
||||||
begin
|
begin
|
||||||
lclSetFrame(Types.Bounds(ALeft, ATop, AWidth, AHeight));
|
lclSetFrame(Types.Bounds(ALeft, ATop, AWidth, AHeight));
|
||||||
|
@ -35,6 +35,7 @@ type
|
|||||||
TCocoaWSCustomFloatSpinEdit = class(TWSCustomFloatSpinEdit)
|
TCocoaWSCustomFloatSpinEdit = class(TWSCustomFloatSpinEdit)
|
||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
|
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
||||||
class function GetValue(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): Double; override;
|
class function GetValue(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): Double; override;
|
||||||
class procedure UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit); override;
|
class procedure UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit); override;
|
||||||
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
|
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||||
@ -66,10 +67,17 @@ begin
|
|||||||
Result := TLCLIntfHandle(lSpin);
|
Result := TLCLIntfHandle(lSpin);
|
||||||
if Result = 0 then Exit;
|
if Result = 0 then Exit;
|
||||||
lSpin.decimalPlaces := -1;
|
lSpin.decimalPlaces := -1;
|
||||||
lSpin.CreateSubcontrols(AParams);
|
lSpin.lclCreateSubcontrols(AParams);
|
||||||
lSpin.callback := TLCLCommonCallback.Create(lSpin, AWinControl);
|
lSpin.callback := TLCLCommonCallback.Create(lSpin, AWinControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TCocoaWSCustomFloatSpinEdit.DestroyHandle(const AWinControl: TWinControl);
|
||||||
|
begin
|
||||||
|
if not AWinControl.HandleAllocated then Exit;
|
||||||
|
TCocoaSpinEdit(AWinControl.Handle).lclReleaseSubcontrols;
|
||||||
|
TCocoaWSWinControl.DestroyHandle(AWinControl);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCocoaWSCustomFloatSpinEdit.GetValue
|
Method: TCocoaWSCustomFloatSpinEdit.GetValue
|
||||||
Params: ACustomFloatSpinEdit - LCL custom float spin edit
|
Params: ACustomFloatSpinEdit - LCL custom float spin edit
|
||||||
|
Loading…
Reference in New Issue
Block a user