mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 16:56:01 +02:00
cocoa: implemenating a storage of stringValue for a custom control (in order to keep text of the control for TPanels). related to #30801
git-svn-id: trunk@56589 -
This commit is contained in:
parent
6273cd1d79
commit
6cb727545e
@ -396,8 +396,11 @@ type
|
||||
{ TCocoaCustomControl }
|
||||
|
||||
TCocoaCustomControl = objcclass(NSControl)
|
||||
private
|
||||
fstr : NSString;
|
||||
public
|
||||
callback: ICommonCallback;
|
||||
procedure dealloc; override;
|
||||
function acceptsFirstResponder: Boolean; override;
|
||||
function becomeFirstResponder: Boolean; override;
|
||||
function resignFirstResponder: Boolean; override;
|
||||
@ -425,6 +428,9 @@ type
|
||||
// other
|
||||
procedure resetCursorRects; override;
|
||||
function lclIsHandle: Boolean; override;
|
||||
// value
|
||||
procedure setStringValue(avalue: NSString); override;
|
||||
function stringValue: NSString; override;
|
||||
end;
|
||||
|
||||
{ TCocoaWindowContent }
|
||||
@ -2138,6 +2144,27 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TCocoaCustomControl.setStringValue(avalue: NSString);
|
||||
begin
|
||||
if Assigned(fstr) then fstr.release;
|
||||
if ASsigned(avalue) then
|
||||
fstr:=avalue.copyWithZone(nil)
|
||||
else
|
||||
fstr:=nil;
|
||||
inherited setStringValue(avalue);
|
||||
end;
|
||||
|
||||
function TCocoaCustomControl.stringValue: NSString;
|
||||
begin
|
||||
Result:=fstr;
|
||||
end;
|
||||
|
||||
procedure TCocoaCustomControl.dealloc;
|
||||
begin
|
||||
if Assigned(fstr) then fstr.release;
|
||||
inherited dealloc;
|
||||
end;
|
||||
|
||||
function TCocoaCustomControl.acceptsFirstResponder: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
|
Loading…
Reference in New Issue
Block a user