mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 11:16: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;
|
||||
ns : NSString;
|
||||
idx : integer;
|
||||
ro : Boolean;
|
||||
const
|
||||
LFSTR = #13#10;
|
||||
begin
|
||||
@ -924,6 +925,10 @@ begin
|
||||
// using selectedRange in order to be consistent with Windows widgetset
|
||||
if rng.location>ns.length then rng.location:=ns.length;
|
||||
inc(FTextView.supressTextChangeEvent);
|
||||
|
||||
ro := FTextView.isEditable; // checking for read-only flag;
|
||||
if not ro then FTextView.setEditable(true);
|
||||
|
||||
FTextView.setSelectedRange(rng);
|
||||
|
||||
if (rng.location>=ns.length) and (st=ced) and (ns.length>0) then
|
||||
@ -936,6 +941,8 @@ begin
|
||||
|
||||
dec(FTextView.supressTextChangeEvent);
|
||||
FTextView.insertText( NSString.stringWithUTF8String( LFSTR ));
|
||||
|
||||
if not ro then FTextView.setEditable(ro);
|
||||
end;
|
||||
|
||||
procedure TCocoaMemoStrings.LoadFromFile(const FileName: string);
|
||||
|
Loading…
Reference in New Issue
Block a user