Page 1 of 1

How to control text position inside wxTextCtrl

Posted: Sun Apr 05, 2009 2:58 am
by keyser
I create a single-line wxTextCtrl, but i found that the text inside wxTextCtrl is vertical-top-aligned.

I capture an image from Outlook Express, it's text ctrl have the similar size and font with mine, but it's text position looks like vertical-center-aligned.

How can i do that ?

Why i cannot post my screen shot here ?

Posted: Mon Apr 06, 2009 2:21 am
by protocol
I'm not sure how to fix the problem, but you can try changing the wxTextCtrl height (decrease the height) to offset the problem.

Re: How to control text position inside wxTextCtrl

Posted: Mon Apr 06, 2009 12:57 pm
by Auria
keyser wrote:I create a single-line wxTextCtrl, but i found that the text inside wxTextCtrl is vertical-top-aligned.

I capture an image from Outlook Express, it's text ctrl have the similar size and font with mine, but it's text position looks like vertical-center-aligned.

How can i do that ?

Why i cannot post my screen shot here ?
Probably it's not editable text text? I never saw an editable text editor vertically centered. Maybe try a HTML view component?

Posted: Wed Apr 15, 2009 4:22 pm
by keyser
Thank you for your answers.

First i try to set the height of wxTextCtrl to the exact height of the text inside. That's actully working fine. But the window very *UGLY* because of the wxTextCtrl.

Second i found lot's of program which has vertical-centered text control. Such as the input box of Windows Caculator. Nearly *EVERY* program's text ctrl *ARE* vertical-centered.

Posted: Wed Apr 15, 2009 5:22 pm
by Auria
keyser wrote: Second i found lot's of program which has vertical-centered text control. Such as the input box of Windows Caculator. Nearly *EVERY* program's text ctrl *ARE* vertical-centered.
Sorry for my ignorance, I suppose those are single-line text controls? In this case, the easiest might be to simply don't set a vertical size, and use the default height. Then it would be just large enough for one line

Posted: Thu Apr 30, 2009 2:40 am
by keyser
Auria wrote:
keyser wrote: Second i found lot's of program which has vertical-centered text control. Such as the input box of Windows Caculator. Nearly *EVERY* program's text ctrl *ARE* vertical-centered.
Sorry for my ignorance, I suppose those are single-line text controls? In this case, the easiest might be to simply don't set a vertical size, and use the default height. Then it would be just large enough for one line
Thank you for your reply.

Yes i mean single line wxTextCtrl.

The first thing i try is use the default size. (I am working with "wxPython 2.8.9.2 For win32 ANSI" on windows xp, and i am using Chinese characters) But it's not cool, the text is top-aligned.

Posted: Fri May 01, 2009 1:35 am
by Auria
Can you show code and screenshot? Granted, I'm not using wxPython on windows, but I never had issues with default sizes not working

Posted: Sat May 23, 2009 10:59 am
by keyser
Auria wrote:Can you show code and screenshot? Granted, I'm not using wxPython on windows, but I never had issues with default sizes not working
Here i captured one picture.

The first wxTextCtrl with no border is vertical-centered.
The second one is cool, it have default size and default border. But what i need is a no-border wxTextCtrl

Posted: Sat May 23, 2009 2:28 pm
by protocol
Please show us the screen shot and the related source code (wxTextCtrl flags used).