Board index » delphi » TMemo left margin shifted to the right

TMemo left margin shifted to the right

Can anyone explain to me why the left "margin" (the distance between the
left edge of the control and where the text begins) of the TMemo has shifted
to the right since Delphi 5? I have about 5 pixels of blank space before the
text begins. This is really annoying if you want the text up against the
left edge.

Is there any way around this?

TIA,
Bruce

 

Re:TMemo left margin shifted to the right


Maybe this:

procedure TForm1.FormCreate(Sender: TObject);
var
  r: TRect;
begin
  r := Rect (0, 0, Memo1.Width, Memo1.Height);
  Memo1.Perform (EM_SETRECT, 0, Integer (@r));
end;

CU, Berend

Quote
Bruce wrote:
> Can anyone explain to me why the left "margin" (the distance between the
> left edge of the control and where the text begins) of the TMemo has shifted
> to the right since Delphi 5? I have about 5 pixels of blank space before the
> text begins. This is really annoying if you want the text up against the
> left edge.

> Is there any way around this?

> TIA,
> Bruce

--
========================================
Berend Veldkamp
Visit our web site: http://www.geodan.nl
========================================

Re:TMemo left margin shifted to the right


Quote
In article <7v80iv$mg...@forums.borland.com>, Bruce wrote:
> Can anyone explain to me why the left "margin" (the distance between the
> left edge of the control and where the text begins) of the TMemo has shifted
> to the right since Delphi 5? I have about 5 pixels of blank space before the
> text begins. This is really annoying if you want the text up against the
> left edge.

Delphi does absolutely nothing to modify the focus rectangle of TMemos you
drop on the form. It has to be in your code somewhere. When i drop a TMemo on
a fresh form there is no "extra" border between the memos border and the
'memo1' text in it.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:TMemo left margin shifted to the right


One more thing- only some of my old apps display this problem with TMemo.
But if I take the old app and open it or recompile it in D5, the problem
appears.

Bruce

Peter Below (TeamB) <100113.1...@compuXXserve.com> wrote in message
news:VA.00003f24.0103adec@noname...

Quote
> In article <7v80iv$mg...@forums.borland.com>, Bruce wrote:
> > Can anyone explain to me why the left "margin" (the distance between the
> > left edge of the control and where the text begins) of the TMemo has
shifted
> > to the right since Delphi 5? I have about 5 pixels of blank space before
the
> > text begins. This is really annoying if you want the text up against the
> > left edge.

> Delphi does absolutely nothing to modify the focus rectangle of TMemos you
> drop on the form. It has to be in your code somewhere. When i drop a TMemo
on
> a fresh form there is no "extra" border between the memos border and the
> 'memo1' text in it.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

Re:TMemo left margin shifted to the right


You are probably right as to it being my system, but it happened about the
time I upgraded to D5. This problem is global to ALL my apps that use a
TMemo, and I think other apps that aren't mine that use a Memo control show
the same behavior, though I can't verify this cause I don't have the source.

I can say that it is NOT in my code, because there is no code when you make
a new app and just drop a native VCL TMemo on it and then notice how the
Memo1 text is offset to the right.

What could be causing this? Since this is built on a Microsoft object, could
that have changed?
Bruce

Peter Below (TeamB) <100113.1...@compuXXserve.com> wrote in message
news:VA.00003f24.0103adec@noname...

Quote
> In article <7v80iv$mg...@forums.borland.com>, Bruce wrote:
> > Can anyone explain to me why the left "margin" (the distance between the
> > left edge of the control and where the text begins) of the TMemo has
shifted
> > to the right since Delphi 5? I have about 5 pixels of blank space before
the
> > text begins. This is really annoying if you want the text up against the
> > left edge.

> Delphi does absolutely nothing to modify the focus rectangle of TMemos you
> drop on the form. It has to be in your code somewhere. When i drop a TMemo
on
> a fresh form there is no "extra" border between the memos border and the
> 'memo1' text in it.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

Re:TMemo left margin shifted to the right


You should be able to duplicate the problem by doing this (sorry about all
the messages):

Drop the TMemo on a new form, the margin should NOT have a problem. But as
soon as you change the font of the TMemo, the margin should shift to the
right, and you cannot get it to go back, even if you change the font back to
System.

Bruce

Re:TMemo left margin shifted to the right


Quote
In article <7vcjj5$22...@forums.borland.com>, Bruce wrote:
> Drop the TMemo on a new form, the margin should NOT have a problem. But as
> soon as you change the font of the TMemo, the margin should shift to the
> right, and you cannot get it to go back, even if you change the font back to
> System.

Nope, not for me. I can change fonts as wildly as i want, the margin does not
change irreversibly. It does not change, period. Win95B. Are you usig Win98SE?
I have heard bad things about it...

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:TMemo left margin shifted to the right


This is totally weird. (I'm using NT Server.)

I'd really be interested to see if anyone else can duplicate this. FYI, this
stays with the app, so no matter what kind of PC the app runs on, where the
app goes, so goes the margin problem.

Oh well...
Bruce

Peter Below (TeamB) <100113.1...@compuXXserve.com> wrote in message
news:VA.00003f3d.00cebcd6@petersnewbox...

Quote
> In article <7vcjj5$22...@forums.borland.com>, Bruce wrote:
> > Drop the TMemo on a new form, the margin should NOT have a problem. But
as
> > soon as you change the font of the TMemo, the margin should shift to the
> > right, and you cannot get it to go back, even if you change the font
back to
> > System.

> Nope, not for me. I can change fonts as wildly as i want, the margin does
not
> change irreversibly. It does not change, period. Win95B. Are you usig
Win98SE?
> I have heard bad things about it...

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

Re:TMemo left margin shifted to the right


On Fri, 29 Oct 1999 16:52:04 -0700, "Bruce" <nospamrdxjc8...@juno.com>
wrote:

Quote
>> > Drop the TMemo on a new form, the margin should NOT have a problem. But
>as
>> > soon as you change the font of the TMemo, the margin should shift to the
>> > right, and you cannot get it to go back, even if you change the font
>back to
>> > System.

Just so you don't feel you're sinking into madness, I can see the
right-shift you've described.  I'm using D3 and Windows 98 (not sure
if it's SE or not).

On my test, I was able to get the memo text back over to the left by
setting Alignment to taRightJustify then taLeftJustify.  Does that
work for you?

Charles Tyson
(for e-mail replies, remove all X's from my address)

Re:TMemo left margin shifted to the right


Nope, same problem. BUT: I have narrowed it down a bit.

1) Dropping a TMemo (default font MS Sans Serif) shows no problem.
2) Changing the font to Arial creates the problem.
3) Changing the font back to MS Sans Serif still has the problem, BUT when
the app is run, the problem goes away. It still shows the margin at
design-time, but at run time the margin is gone (only if the font is MS Sans
Serif).

I realize this is a trivial problem, but it is driving me batty....
Bruce

Quote
> Just so you don't feel you're sinking into madness, I can see the
> right-shift you've described.  I'm using D3 and Windows 98 (not sure
> if it's SE or not).

> On my test, I was able to get the memo text back over to the left by
> setting Alignment to taRightJustify then taLeftJustify.  Does that
> work for you?

> Charles Tyson
> (for e-mail replies, remove all X's from my address)

Other Threads