Forum > LCL

Setting tab indent width in TMemo or TStringList

(1/2) > >>

Fantablup:
I have a big problem setting the tab width when inserting the #9 character in any string.
The default tab width is too long.
I googled about Lazarus, and how to set default tab width, but nothing.
Tmemo and TStringList dont have any tab width settings.

It seems that this could be a big problem for others too.

I just neet to set the tab width to 6, but i just can't figure out how.
i'm adding strings to TStringList, and after adding it to a TMemo.
Is it possible to set tab width to strings in TStringList? and also use tab width on TMemo when user press the tab?

I tried finding a soulution, but after six hours searching i gave up the search.

lucamar:
The only way to do something like that would be replacing the tab character by the corresponding number of spaces.

For TStringList you could it overriding all string-addition methods: Add, Insert, etc.

For TMemo the problem you would have to do the same for the inner Lines property (not easy)

Of course, doing that would destroy the Tab character itself, so if you want to keep it you'll have to find other method dealing only with how (or what) is "drawn" when a Tab character is encountered.

It's not a trivial problem and I'd strongly suggest that you find/use another control already prepared for that, like e.g. TSynEdit.

Fantablup:
Thanks lucamar!

I thought this would be a big problem.
Using spaces instead just destroys the tab character, so that is not a solution as you also say.
Well, nothing can be done with these controls then.

Thanks for the tip on Tsynedit.
I tried it.
I can use that i think.

Fantablup:
Using TsynEdit works.

Thanks again for this good tip  :)

Fantablup:
That means that working with TMemo/TDBMemo or a Tstringlist is just no go when you need to set tab width?
It seems to me that these components is not ready to use then.

Navigation

[0] Message Index

[#] Next page

Go to full version