Recent

Author Topic: TMEmo change background at runtime  (Read 1095 times)

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
TMEmo change background at runtime
« on: March 19, 2026, 03:12:56 am »
Hi i have a Tmemo to handle datas for serial port but some user wants to show the background on different colors  you knwo many users has black background to distinguish more clear...

how i can do that...

dsiders

  • Hero Member
  • *****
  • Posts: 1657
Re: TMEmo change background at runtime
« Reply #1 on: March 19, 2026, 03:54:42 am »
Hi i have a Tmemo to handle datas for serial port but some user wants to show the background on different colors  you knwo many users has black background to distinguish more clear...

how i can do that...

If you talking about colorizing the entire content you can use TMemo.Color and TMemo.Font.Color. May not work on macOS (but you didn't specify).

If you're talking about individual lines or words in the text, then TMemo is the wrong control - it doesn't have that kind of formatting capability.

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
Re: TMEmo change background at runtime
« Reply #2 on: March 19, 2026, 04:34:41 pm »
Is the hold content not just some specific words...

cdbc

  • Hero Member
  • *****
  • Posts: 2872
    • http://www.cdbc.dk
Re: TMEmo change background at runtime
« Reply #3 on: March 19, 2026, 06:17:47 pm »
Hi
Quote
Is the hold content not just some specific words...
IIUC, you'd need 'SynEdit' and write a 'HighLighter' for that, just like in the Lazarus editor...
But, for TMemo it is as Don said: TMemo.Color & TMemo.Font.Color
Regards Benny

edit: Attached a screenshot of Synedit with custom highlighter.
« Last Edit: March 19, 2026, 06:22:05 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
Re: TMEmo change background at runtime
« Reply #4 on: March 20, 2026, 02:09:55 pm »
Ok Thanks let me test synedit...

cdbc

  • Hero Member
  • *****
  • Posts: 2872
    • http://www.cdbc.dk
Re: TMEmo change background at runtime
« Reply #5 on: March 20, 2026, 02:22:46 pm »
Hi
If it can help you get started, here are the components from above screenshot, attached...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
Re: TMEmo change background at runtime
« Reply #6 on: March 22, 2026, 12:52:55 am »
Thanks DCbc

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
Re: TMEmo change background at runtime
« Reply #7 on: May 26, 2026, 08:39:13 pm »
Hello what contain file uses cdbc.advstring;   to try to implement on my app.

Thanks

cdbc

  • Hero Member
  • *****
  • Posts: 2872
    • http://www.cdbc.dk
Re: TMEmo change background at runtime
« Reply #8 on: May 26, 2026, 09:13:44 pm »
Hi
...Remember -- You asked for it  :D ;D
It uses some units from lazutils...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
Re: TMEmo change background at runtime
« Reply #9 on: May 26, 2026, 11:54:42 pm »
Thanks but is naother file  cdbc.unicode missing...

well somuch
 

cdbc

  • Hero Member
  • *****
  • Posts: 2872
    • http://www.cdbc.dk
Re: TMEmo change background at runtime
« Reply #10 on: May 27, 2026, 01:15:51 am »
Okidoki
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

eldonfsr

  • Hero Member
  • *****
  • Posts: 598
Re: TMEmo change background at runtime
« Reply #11 on: May 27, 2026, 03:47:55 pm »
Thanks my friend i think you are no use this often try to compile and istrlist missing , check on internet but is not a package or unit what simple incude on uses ...


eldonfsr

  • Hero Member
  • *****
  • Posts: 598
Re: TMEmo change background at runtime
« Reply #12 on: May 27, 2026, 04:56:55 pm »
You are using a packege called svc or what i got istrllist and get another missing svc.wordutil looks like a package i look on internet i dont see that package avalible to donwload.....

Aruna

  • Hero Member
  • *****
  • Posts: 814
Re: TMEmo change background at runtime
« Reply #13 on: May 27, 2026, 05:01:36 pm »
Hi i have a Tmemo to handle datas for serial port but some user wants to show the background on different colors  you knwo many users has black background to distinguish more clear...

how i can do that...
Please have a look at the attached screenshots. The zip file has a working demo which will show you how to go about doing that. 

Aruna

  • Hero Member
  • *****
  • Posts: 814
Re: TMEmo change background at runtime
« Reply #14 on: May 27, 2026, 06:03:37 pm »
Hi i have a Tmemo to handle datas for serial port but some user wants to show the background on different colors  you knwo many users has black background to distinguish more clear...

how i can do that...
Hi, this simulates incoming serial data and changes the TMemo background color accordingly.

 

TinyPortal © 2005-2018