Recent

Author Topic: Vertical alignment of text within TEdit  (Read 946 times)

pleumann

  • Jr. Member
  • **
  • Posts: 94
Vertical alignment of text within TEdit
« on: May 08, 2023, 04:22:01 pm »
Is there a way to vertically center the text within a TEdit, similar to TLabel.Layout or is that not generally possible because the underlying OS control would need to support that everywhere?

Cheers
Joerg

pleumann

  • Jr. Member
  • **
  • Posts: 94
Re: Vertical alignment of text within TEdit
« Reply #1 on: May 08, 2023, 05:22:42 pm »
Thinking about it, maybe my problem is different. I am setting the font size of my TEdit to 18 instead of 12. While the cursor initially appears in the right location, the actual text content I type is positioned "too high" and hence only partially visible. I thought it would be caused by me disabling AutoSize and setting my own size for the TEdit, but it's the same with AutoSize enabled.

This is Lazarus 2.2.6 with FPC 3.2.2 on MacOS Monterey (hi-res iMac, but I tried fiddling with the project properties already).

pleumann

  • Jr. Member
  • **
  • Posts: 94
Re: Vertical alignment of text within TEdit
« Reply #2 on: May 08, 2023, 06:02:42 pm »
Weird. If I set the font name to "default" it's fine. For all other fonts it looks wrong (I didn't actually try all, of course, but a couple including Arial and some Mac-specific fonts).

Ten_Mile_Hike

  • Jr. Member
  • **
  • Posts: 50
Re: Vertical alignment of text within TEdit
« Reply #3 on: May 09, 2023, 08:32:08 pm »
Also; the "anti aliasing" property might be causing a hidden problem for you

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: Vertical alignment of text within TEdit
« Reply #4 on: May 09, 2023, 11:01:57 pm »
I know there is some font-related code in LCL scaling, and it looks as if something is missing for the cocoa widgetset. You should post this issue in the bug tracker (see link in the left side-bar) so that developers can see it.

pleumann

  • Jr. Member
  • **
  • Posts: 94
Re: Vertical alignment of text within TEdit
« Reply #5 on: May 11, 2023, 06:26:20 pm »
Also; the "anti aliasing" property might be causing a hidden problem for you
Anti-aliasing doesn't seem to affect my problem. I tried all available values for the TFont.Quality property (I assume that's what you meant).

I know there is some font-related code in LCL scaling, and it looks as if something is missing for the cocoa widgetset. You should post this issue in the bug tracker (see link in the left side-bar) so that developers can see it.
I'll file a bug then.

Thanks for responding!

pleumann

  • Jr. Member
  • **
  • Posts: 94

 

TinyPortal © 2005-2018