Recent

Author Topic: [SOLVED -- mostly] Show last line of TMemo after text change  (Read 2671 times)

jamie

  • Hero Member
  • *****
  • Posts: 6995
Re: [SOLVED -- mostly] Show last line of TMemo after text change
« Reply #15 on: April 29, 2023, 06:28:56 pm »
BAC, By Any chance

In any case, It looks like you need a why to have a list of files loaded and indicators to show if they actually deleted?

Wouldn't a checkbox list work for you, so that you can check off the ones beside the names that were successfully deleted?
The only true wisdom is knowing you know nothing

willbprog9933

  • Jr. Member
  • **
  • Posts: 93
  • Big guy, tiny brain :P
    • BrainOut!
Re: [SOLVED -- mostly] Show last line of TMemo after text change
« Reply #16 on: April 29, 2023, 06:37:20 pm »
BAC, By Any chance

In any case, It looks like you need a why to have a list of files loaded and indicators to show if they actually deleted?

Wouldn't a checkbox list work for you, so that you can check off the ones beside the names that were successfully deleted?

Oh, thanks for clearing up "BAC".  I'm on the spectrum so I sometimes miss these things.

You know, I did think about using a checklist, but I also display other information in the TMemo, thus the desire to stick with it.

As far as multi-threading, no, not using threads or anything.  My app calls a command-line program, which then contacts a service on the internet then returns the status afterward, thus the somewhat clunky workflow.  Overall it works fairly well on Windows as well as Linux, so I'm grateful.  I just wanted the user experience to be a little more friendly and have the TMemo scroll to the bottom on long tasks.  It still doesn't scroll when using ScrollTo, VertScrollBar.Position, SelStart and SelLength.  I'll have to do a minimal project and file a bug report about it, if there isn't one already.

Thanks! :D
macOS, Linux, FreeBSD and sometimes OpenIndiana.

Blessed, loved and forgiven! :D

willbprog9933

  • Jr. Member
  • **
  • Posts: 93
  • Big guy, tiny brain :P
    • BrainOut!
Re: [SOLVED -- mostly] Show last line of TMemo after text change
« Reply #17 on: April 29, 2023, 06:59:00 pm »
Okay, I found the following bug report, which seems to be fixed, however, when I modify the attached example to use Memo1.Text := Memo1.Text + string + LineEnding instead of Add the scrolling doesn't work anymore.  This seems to be a bug.

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/37673

I have attached the modified version to this post.  Can you guys check it out and see if the buttons scroll the TMemo?

Thanks! :D
macOS, Linux, FreeBSD and sometimes OpenIndiana.

Blessed, loved and forgiven! :D

jamie

  • Hero Member
  • *****
  • Posts: 6995
Re: [SOLVED -- mostly] Show last line of TMemo after text change
« Reply #18 on: April 29, 2023, 07:25:17 pm »
it looks like you keep replacing the whole MEMO string with a single entry each time.

why don't you work with a TStringList, add to that and simply update the memo whenever you want to see it?


 Add to the list and to display it..

 Memo1.Lines.Text := StringList.Text;
 Application.ProcessMessages.

 Of course the list can be large if you don't delete some old first entries.
The only true wisdom is knowing you know nothing

willbprog9933

  • Jr. Member
  • **
  • Posts: 93
  • Big guy, tiny brain :P
    • BrainOut!
Re: [SOLVED -- mostly] Show last line of TMemo after text change
« Reply #19 on: April 29, 2023, 07:30:25 pm »
it looks like you keep replacing the whole MEMO string with a single entry each time.

why don't you work with a TStringList, add to that and simply update the memo whenever you want to see it?


 Add to the list and to display it..

 Memo1.Lines.Text := StringList.Text;
 Application.ProcessMessages.

 Of course the list can be large if you don't delete some old first entries.

Thanks jamie.  I'm actually replacing the whole TMemo string with its existing value plus additional text in that revised example that I downloaded from the bug report.

Just to be clear, I used TRon's workaround for my own app, but I'm trying to see if others are having the same problem I had with the bug report's revised example.

Thanks! :D
macOS, Linux, FreeBSD and sometimes OpenIndiana.

Blessed, loved and forgiven! :D

 

TinyPortal © 2005-2018