Recent

Author Topic: TMemo - Show formatting  (Read 2647 times)

Zath

  • Sr. Member
  • ****
  • Posts: 391
TMemo - Show formatting
« on: January 19, 2019, 12:40:37 am »
TMemo - Show formatting
Is there a way to show document formatting in a Tmemo, such as return, tab, space etc ?

Should I use another component instead ?

Thanks
« Last Edit: January 19, 2019, 01:17:53 am by Zath »

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: TMemo - Show formatting
« Reply #1 on: January 19, 2019, 02:21:30 am »
TMemo is ust plaain text, no formatting, no images, just text.

Maybe try TRichMemo instead, using embedded images for the formatting elements you want to show.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: TMemo - Show formatting
« Reply #2 on: January 19, 2019, 03:05:35 am »
TMemo is ust plaain text, no formatting, no images, just text.

Maybe try TRichMemo instead, using embedded images for the formatting elements you want to show.

Thanks.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: TMemo - Show formatting
« Reply #3 on: January 19, 2019, 03:17:42 am »
or, of course KMemo. http://wiki.freepascal.org/KControls/KmemoNotes

RichMemo is a lighter weight install but missing a few features. KMemo works, mostly, across Linux, Windows and Mac

KMemo is no longer being actively maintained by its 'owner' but he is accepting and applying fixes.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: TMemo - Show formatting
« Reply #4 on: January 19, 2019, 07:02:33 pm »
Tmemo should understand spaces and TAB characters.

In windows, it may even understand some of the AnsiEscape codes.
The only true wisdom is knowing you know nothing

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: TMemo - Show formatting
« Reply #5 on: January 19, 2019, 07:07:19 pm »
TMemo - Show formatting
Is there a way to show document formatting in a Tmemo, such as return, tab, space etc ?

These are control characters, not formatting. This can probably be done if you use a font that has defined non-printable characters. But I have never tried it, so you'd have to check.
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TMemo - Show formatting
« Reply #6 on: January 19, 2019, 07:37:56 pm »
In windows, it may even understand some of the AnsiEscape codes.

Nope. TMemo is a pure-text control; basically a multi-line TEdit.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: TMemo - Show formatting
« Reply #7 on: January 19, 2019, 10:48:22 pm »
But it does understand the control characters like the #9 for tab which works btw
The only true wisdom is knowing you know nothing

creaothceann

  • Full Member
  • ***
  • Posts: 117
Re: TMemo - Show formatting
« Reply #8 on: January 20, 2019, 12:16:56 pm »
But it does understand the control characters like the #9 for tab which works btw

Show formatting

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: TMemo - Show formatting
« Reply #9 on: January 20, 2019, 03:42:53 pm »
But it does understand the control characters like the #9 for tab which works btw
It would be possible to modify the text prior to adding to the TMemo by taking the input string from wherever it is created and replacing each instance of (for example)

Space (32) with underscore '_'   char(95)
Tab (9) with Tilde '~' char(126)
LineFeed (10) with Exclamation '!' char(33)
Return (13) with Octothorpe '#' char(35)

Or even more readable,    9 with '[TAB]',   10 with '[LF]',    13 with '[RET]' - there would be little point in using '[SP]' when the underscore works very well for space.

It would be a simple Find & Replace exercise.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

 

TinyPortal © 2005-2018