Recent

Author Topic: TMemo CanUndo with a padlock and no undo  (Read 6224 times)

KarenT

  • Full Member
  • ***
  • Posts: 120
TMemo CanUndo with a padlock and no undo
« on: July 07, 2017, 10:06:19 pm »
Hello, a bit baffled by TMemo in Ubuntu.

When typing "myMemo." and pausing, i get the suggestions display and "CanUndo" is shown with a red padlock.

Also, "myMemo.Undo" does not work.

I checked around and found
http://forum.lazarus.freepascal.org/index.php/topic,33727.msg218889.html#msg218889

But no replies, so with fingers-crossed and some 11-months later, I am hoping there is some joy in this area for me. Anyone?

I looked at SynEdit which as undo but it has a lot of different functions to a standard Memo and way too much work for me to use. I just want to add "undo" to an old program I have written and do not want to have to spend many hours with SynEdit and the Caret! :)

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: TMemo CanUndo with a padlock and no undo
« Reply #1 on: July 07, 2017, 10:27:15 pm »
That's a verifyable bug:
Code: Pascal  [Select][+][-]
  1. // memo + button. Change the content of the memo. No undo....
  2. procedure TForm1.Button1Click(Sender: TObject);
  3. begin
  4.   if memo1.CanUndo then memo1.Undo;
  5. end;

Does not work on linux. Sloppy. Plz report it.
Note on Windows this works AFAIK.
« Last Edit: July 07, 2017, 10:28:49 pm by Thaddy »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6675
  • Debugger - SynEdit - and more
    • wiki
Re: TMemo CanUndo with a padlock and no undo
« Reply #2 on: July 07, 2017, 10:29:47 pm »
When typing "myMemo." and pausing, i get the suggestions display and "CanUndo" is shown with a red padlock.
You are talking about typing into the source editor of the IDE?

Not sure, but from a quick look: the red-padlock indicates a read only property.
That is correct: "TMemo.CanUndo" is read only. If it returns true, then you can call "TMemo.Undo" and something will be undone.
If "TMemo.CanUndo" returns false, then "TMemo.Undo" will do nothing.

As for the rest, please report on the bugtracker.

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: TMemo CanUndo with a padlock and no undo
« Reply #3 on: July 07, 2017, 10:38:04 pm »
I will leave that to OP. It is an old an known bug on Linux. In this case re-report KarenT, so it will not be forgotten again.
Technically this is missing functionality. It won't crash code, but it does nothing on Linux GTK2 because CanUndo will always return false..
« Last Edit: July 07, 2017, 10:42:13 pm by Thaddy »

KarenT

  • Full Member
  • ***
  • Posts: 120
Re: TMemo CanUndo with a padlock and no undo
« Reply #4 on: July 08, 2017, 10:48:20 pm »
In this case re-report KarenT, so it will not be forgotten again.

Is there much point in reporting it again? That post I mentioned was August 2016, looks like no one cares about Linux -- again, or should that be "-- still." :)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3858
  • I like bugs.
Re: TMemo CanUndo with a padlock and no undo
« Reply #5 on: July 09, 2017, 12:06:40 am »
Is there much point in reporting it again? That post I mentioned was August 2016, looks like no one cares about Linux -- again, or should that be "-- still." :)
Is it reported in bug tracker? If not then it should be reported.
"Linux" is a wrong term here. The issue is related to widgetset, not to OS. I guess you are using GTK2. You can try also QT.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 835
Re: TMemo CanUndo with a padlock and no undo
« Reply #6 on: July 09, 2017, 01:04:46 am »
hello,
it seems that only carbon, qt , win32, wince interfaces can do an undo. It's not a bug for the other interfaces, it's a not implemented function   :P

gtk3 always return false :
Code: Pascal  [Select][+][-]
  1. class function TGtk3WSCustomMemo.GetCanUndo(const ACustomEdit: TCustomEdit
  2.   ): Boolean;
  3. begin
  4.   Result := False;
  5. end;
  6.  

Friendly, J.P
« Last Edit: July 09, 2017, 01:22:04 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
    • havefunsoft.com
Re: TMemo CanUndo with a padlock and no undo
« Reply #7 on: July 09, 2017, 02:48:06 am »
KarenT, do you need undo that bad on gtk2?
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 835
Re: TMemo CanUndo with a padlock and no undo
« Reply #8 on: July 09, 2017, 03:55:37 am »
i confirm that undo is ok on Linux Qt .
with this code :
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   if memo1.CanUndo then memo1.Undo;
  4. end;
you can see in attachment the result.
tried on Linux Lubuntu 16.04  64 bits Qt4 Lazarus 1.8RC3
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: TMemo CanUndo with a padlock and no undo
« Reply #9 on: July 09, 2017, 05:01:13 am »
i confirm that undo is ok on Linux Qt .
with this code :
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   if memo1.CanUndo then memo1.Undo;
  4. end;
you can see in attachment the result.
tried on Linux Lubuntu 16.04  64 bits Qt4 Lazarus 1.8RC3
may I ask which program you use to create those gifs?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 835
Re: TMemo CanUndo with a padlock and no undo
« Reply #10 on: July 09, 2017, 10:11:38 am »
hello
may I ask which program you use to create those gifs?

with peek

friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
    • havefunsoft.com
Re: TMemo CanUndo with a padlock and no undo
« Reply #11 on: July 10, 2017, 06:19:19 pm »
KarenT, do you need undo that bad on gtk2?
because, if you do, there's something that could be done!
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: TMemo CanUndo with a padlock and no undo
« Reply #12 on: July 10, 2017, 08:29:22 pm »
KarenT, do you need undo that bad on gtk2?
because, if you do, there's something that could be done!
Yes, apparently by multiple people... I have a simple working undo stack available based on code I found over the weekend...

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: TMemo CanUndo with a padlock and no undo
« Reply #13 on: July 12, 2017, 01:42:57 pm »
hello
may I ask which program you use to create those gifs?

with peek

friendly, J.P
thank you!
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: TMemo CanUndo with a padlock and no undo
« Reply #14 on: July 12, 2017, 01:46:09 pm »
Duh. anyone want the code or not...

 

TinyPortal © 2005-2018