mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 16:49:07 +02:00
cocoa: allow insert texts in readonly mode. #33153
git-svn-id: trunk@57281 -
This commit is contained in:
parent
ad5b73def1
commit
022efcf9e9
@ -908,6 +908,7 @@ var
|
|||||||
ced : NSUInteger;
|
ced : NSUInteger;
|
||||||
ns : NSString;
|
ns : NSString;
|
||||||
idx : integer;
|
idx : integer;
|
||||||
|
ro : Boolean;
|
||||||
const
|
const
|
||||||
LFSTR = #13#10;
|
LFSTR = #13#10;
|
||||||
begin
|
begin
|
||||||
@ -924,6 +925,10 @@ begin
|
|||||||
// using selectedRange in order to be consistent with Windows widgetset
|
// using selectedRange in order to be consistent with Windows widgetset
|
||||||
if rng.location>ns.length then rng.location:=ns.length;
|
if rng.location>ns.length then rng.location:=ns.length;
|
||||||
inc(FTextView.supressTextChangeEvent);
|
inc(FTextView.supressTextChangeEvent);
|
||||||
|
|
||||||
|
ro := FTextView.isEditable; // checking for read-only flag;
|
||||||
|
if not ro then FTextView.setEditable(true);
|
||||||
|
|
||||||
FTextView.setSelectedRange(rng);
|
FTextView.setSelectedRange(rng);
|
||||||
|
|
||||||
if (rng.location>=ns.length) and (st=ced) and (ns.length>0) then
|
if (rng.location>=ns.length) and (st=ced) and (ns.length>0) then
|
||||||
@ -936,6 +941,8 @@ begin
|
|||||||
|
|
||||||
dec(FTextView.supressTextChangeEvent);
|
dec(FTextView.supressTextChangeEvent);
|
||||||
FTextView.insertText( NSString.stringWithUTF8String( LFSTR ));
|
FTextView.insertText( NSString.stringWithUTF8String( LFSTR ));
|
||||||
|
|
||||||
|
if not ro then FTextView.setEditable(ro);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCocoaMemoStrings.LoadFromFile(const FileName: string);
|
procedure TCocoaMemoStrings.LoadFromFile(const FileName: string);
|
||||||
|
Loading…
Reference in New Issue
Block a user