Recent

Author Topic: UTF8String in a Memo (solved)  (Read 1895 times)

dseligo

  • Hero Member
  • *****
  • Posts: 1222
Re: UTF8String in a Memo
« Reply #15 on: January 13, 2023, 08:16:32 pm »
Hallo dseligo, why? I have installed it. Are there bugs in it??

I'm sure there are bugs in it. :)
In your code or TMemo? Read Bart's reply.
And in Lazarus TMemo is always UTF8 String, because string is already UTF8.

My code? In this thread I didn't give any code. And I didn't refer to TMemo, but to Lazarus 1.6.4 in general.

Thaddy

  • Hero Member
  • *****
  • Posts: 14377
  • Sensorship about opinions does not belong here.
Re: UTF8String in a Memo
« Reply #16 on: January 13, 2023, 08:58:45 pm »
You did mention Tmemo and Lazarus 1.6.4 is very old.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

dseligo

  • Hero Member
  • *****
  • Posts: 1222
Re: UTF8String in a Memo
« Reply #17 on: January 14, 2023, 12:14:05 am »
You did mention Tmemo and Lazarus 1.6.4 is very old.

I didn't mentioned TMemo at all. Look at my posts.
And I didn't say how old Lazarus 1.6.4 is, but to use current version if he's starting project in Lazarus.

You probably confused my posts with somebody else's post.
« Last Edit: January 14, 2023, 12:16:03 am by dseligo »

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: UTF8String in a Memo
« Reply #18 on: January 14, 2023, 12:53:54 am »
.....
Hallo dseligo, why? I have installed it. Are there bugs in it??

Pit, there are 731 net commits to Lazarus between 2.2.2 and 2.2.4, git is unreliable as to the actual count much further back due to to historical issues. We have to assume there have been quite a lot of commits between early 2017 (1.6.4) and when 2.2.4 was released. Not all bugs but a lot of new or improved features that are also probably of benefit to you too.

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

Pit

  • New member
  • *
  • Posts: 8
Re: UTF8String in a Memo
« Reply #19 on: January 14, 2023, 02:48:20 pm »
A frriendly hello to anybody,

Thank You for your answers.

Hello Bart,
thank you, you opend up my eyes! The Memo is nil, because the I thought that I create the main object in the hierarchy and transvered the memo. With "if Assigned" it works.

The TStringlist confused me. With Delphi I can use Sl.Text or Sl.Commatext.

Code: Pascal  [Select][+][-]
  1. Sl := TStringlist.Create;
  2. S := SendStr;
  3. Sl.Text := S;
  4. Sl.Add( '======' );
  5. S2 := Sl.Strings[0];
  6. S2 := S2 + '<<<';

The window "show/modify" shows me looking for Sl:
<TSTRINGLIST> = {
  <TSTRINGS> = {
    <TPERSISTENT> = {
      <TOBJECT> = {
        _vptr$ = {
          0x58fcb4,
          0x0}},
...

Sl.Strings[0] results "Type TSTRINGLIST has no component named STRINGS[0].". So I thought the reason is the Stringtype.

S2 := Sl.Strings[0]; works, I see the string but not with the window "show/modify". Delphi shows me te contend with "Sl.Strings[0]" and "Sl.Text" and "Sl.Commatext". Can you tel me the reason?

Hello dseligo,
Quote
I'm sure there are bugs in it. :)

It is not enough. Do you know it?? I want to know how to work with Lazarus and then, may be, with a newer version.

Hallo Thaddy, good information.

Greetings Pit

rvk

  • Hero Member
  • *****
  • Posts: 6169
Re: UTF8String in a Memo
« Reply #20 on: January 14, 2023, 03:06:18 pm »
S2 := Sl.Strings[0]; works, I see the string but not with the window "show/modify". Delphi shows me te contend with "Sl.Strings[0]" and "Sl.Text" and "Sl.Commatext". Can you tel me the reason?
That's because the debugger isn't that great in Lazarus.
It doesn't support setters en getters yet (and Strings is a property which can only be accessed via a getter function).

Sometimes you can use the protected variable of the property.
For example object.FText instead of object.Text.
But that isn't always available.

I think there are some improvements in the new debugger in the latest Lazarus but with GDB (the old default debugger) your options of viewing properties is very limited.


Pit

  • New member
  • *
  • Posts: 8
Re: UTF8String in a Memo
« Reply #21 on: January 14, 2023, 03:17:03 pm »
Hallo to anybody,

sorry I did not see the second page.

Hallo Davo, 2017 is not long ago, but if my problem above is solved with a newer version you are right.

Hello rvk, I yust have seen your post. Thank you. FText does not work too. But now I know how to handle it.

Greetings Pit

rvk

  • Hero Member
  • *****
  • Posts: 6169
Re: UTF8String in a Memo
« Reply #22 on: January 14, 2023, 04:49:19 pm »
Hallo Davo, 2017 is not long ago, but if my problem above is solved with a newer version you are right.
Haha, 2017 is ages ago in the technical sector.

Latest version won't fix all your problems but at least then you are on s version everyone is using and problems that remain will be clear for everyone. I.e. the latest version uses utf8 in string while very old versions can't handle utf8. Laz 1.6 is a inbetween version where you need to do special thing to use utf8 while with the latest version this is more transparent.

 

TinyPortal © 2005-2018