Lazarus

Programming => General => Topic started by: KarenT on July 07, 2017, 10:06:19 pm

Title: TMemo CanUndo with a padlock and no undo
Post by: KarenT 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! :)
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Thaddy 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.
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Martin_fr 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.
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Thaddy 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..
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: KarenT 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." :)
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: JuhaManninen 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.
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Jurassic Pork 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
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: skalogryz on July 09, 2017, 02:48:06 am
KarenT, do you need undo that bad on gtk2?
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Jurassic Pork 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
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: taazz 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?
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Jurassic Pork on July 09, 2017, 10:11:38 am
hello
may I ask which program you use to create those gifs?

with peek (https://github.com/phw/peek/blob/master/README.md)

friendly, J.P
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: skalogryz 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!
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Thaddy 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...
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: taazz on July 12, 2017, 01:42:57 pm
hello
may I ask which program you use to create those gifs?

with peek (https://github.com/phw/peek/blob/master/README.md)

friendly, J.P
thank you!
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: Thaddy on July 12, 2017, 01:46:09 pm
Duh. anyone want the code or not...
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: tomitomy on October 18, 2017, 06:31:11 am
Duh. anyone want the code or not...

Yes, I need the Undo function. Thank you Thaddy!
Title: Re: TMemo CanUndo with a padlock and no undo
Post by: fedkad on January 02, 2018, 04:29:31 pm
KarenT, do you need undo that bad on gtk2?

Is there a plan to implement this missing functionality any time soon?
TinyPortal © 2005-2018