How to vertically centre DesktopTextField text?

I must be missing something very obvious here, but cannot get it fixed. How do I get text in a DesktopTextField centred vertically? I don’t see options for this in the Properties panel. It seems to be Top aligned by default.

Screenshot 2023-04-29 at 07.58.09

Get the text height,
change the DesktopTextField Height accordingly,
move the DesktopTextField to be where you need it

Is it OK for you ?

Yes, this seems to be a good work around. Thanks. I found that 24 high text field with a 14 font size looks good.

To solve this, I would be interested to have a cocoa declare that allow us to change the vertical alignment/position of the text in a TextField. Unfortunately, I don’t find it and am not a declare guru.

Just for clarity, there’s no “easy” declare to do this (on macOS anyway). The only solution I’ve found requires subclassing the OS control (NSTextField in this case) and overriding the alignment of the underlying editing cell in each of the editing states. @Emile_Schwarz 's solution is a much faster and less hacky solution to the problem.

Keep in mind though… The vertical positioning of controls changes from year to year and is certainly not accurate in the IDE at all times. It does its best to show you baseline alignments in the version of macOS that you are currently running, but there’s no automatic alignment going on at runtime. If you notice a discrepancy, you’ll need to move the controls yourself.

Oh. I see. Thank you Greg.
My concern is this :

I’d like to adapt the baseline for the textfield in Verdana font
(The textfields are 22 pixels height)

Yeah, unfortunately Xojo doesn’t use constraints on desktop (because of the cross platform thing) and that means we can’t just say “align the baseline of this control to the baseline of that one”.