TMSFMXMemo bugs

Hi Pieter


A couple of bugs I've noticed:

1. If I try and click at the beginning of a line the cursor is always one space to the right - I need to use the Home key to place the cursor at the beginning. If I click too far to the left the cursor appears in the line below.

2. If I use Lucida Console with the Basic styler or Courier New with the Pascal styler then the text looks fine. But if I use Lucida Console with the Pascal styler the cursor quickly gets out of step - e.g. I need to use 2 spaces for a space to be visible. I use font size = 13.

I'm using 2.5.3.2

Kind regards, Bob
  1. We traced & solved this issue. The next update will address this.

    2) Is this on Windows? We retested this but I could not see an issue here when using the Lucida Console font. Are you sure this is still a fixed width font on your system?

Hi Bruno


I'm using Win7, but had forgotten that I'm using a modified FMX.Canvas.D2D with DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for the text rendering. I've checked with the original D2D and the problem is much less obvious, but still there. E.g. as I type "procedure" I get to "procedur" and everything is fine and after the "e" is added the styling kicks in and the cursor is located in the middle of the "e".

Any idea how I check if Lucida Console is fixed width on my system?

Cheers, Bob 

Hi Bruno


In my previous posts when I mention cursor I actually meant to say caret.

On further use I've found a problem that makes the memo rather annoying to use. If I click on a line and the cursor is overlapping the line below by even a small amount then the caret appears on the line below. This feels very unnatural - I'd expect it to be a 50% thing like the Delphi editor.

Cheers, Bob 

Another small bug - when I hit the Tab key it tabs the components on the form, rather than insert a tab in the editor.


Cheers, Bob

Hi Bruno/Pieter


As I mentioned I'm using a modified FMX.Canvas.D2D with the text output using GDI classic mode. This eliminates the slightly fuzzy text that default FMX generates. I've a feeling I'll need to introduce modified text calculations for this in a descendent version. I notice that the text calcs were updated in the recent version - which routines would I need to modify?

Thanks, Bob
  1. Tab key is right-now designated to move focus to other controls. We'll investigate to make it optionally add a tab in the memo.

    2) Text calculation inside TMSFMXMemo was not designed to be easy to override. For the GDI classic mode issue, I'm not sure if/how we can support modified FMX frameworks. What exact calculation function do you need to be able to override?

Hi Bruno


>I'm not sure if/how we can support modified FMX frameworks

That's no problem, I wouldn't expect you to. I've accepted I'll need to hack FMX to get what I need! I'm fine with maintaining a modified version of the memo code.

>What exact calculation function do you need to be able to override?

That's what I'm not sure - I've had a quick look at the source but thought I'd confirm with you what functions I should be looking at for the text drawing.

Thanks, Bob

with respect to text size calculation, one of the critical functions is the method CalculateCellSize

TMSMemo have bug with calculating text size when used font with variables words width

TTMSFMXMemo is based on the use of fixed width fonts like many other syntax highlighting editors. Do you use a variable width font?