mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 14:29:36 +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 }
|
||||||
|
|
||||||
TCocoaCustomControl = objcclass(NSControl)
|
TCocoaCustomControl = objcclass(NSControl)
|
||||||
|
private
|
||||||
|
fstr : NSString;
|
||||||
public
|
public
|
||||||
callback: ICommonCallback;
|
callback: ICommonCallback;
|
||||||
|
procedure dealloc; override;
|
||||||
function acceptsFirstResponder: Boolean; override;
|
function acceptsFirstResponder: Boolean; override;
|
||||||
function becomeFirstResponder: Boolean; override;
|
function becomeFirstResponder: Boolean; override;
|
||||||
function resignFirstResponder: Boolean; override;
|
function resignFirstResponder: Boolean; override;
|
||||||
@ -425,6 +428,9 @@ type
|
|||||||
// other
|
// other
|
||||||
procedure resetCursorRects; override;
|
procedure resetCursorRects; override;
|
||||||
function lclIsHandle: Boolean; override;
|
function lclIsHandle: Boolean; override;
|
||||||
|
// value
|
||||||
|
procedure setStringValue(avalue: NSString); override;
|
||||||
|
function stringValue: NSString; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCocoaWindowContent }
|
{ TCocoaWindowContent }
|
||||||
@ -2138,6 +2144,27 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
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;
|
function TCocoaCustomControl.acceptsFirstResponder: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
|
Loading…
Reference in New Issue
Block a user