Re: wxtextCtrl text placement

Andre F <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <CANdLyG2YMKeJ3uwRMsy1sax68u40TFmJSXuMiT=D3K=EPQg5HQ@mail.gmail.com>
Problem resolved! Thank you!!

On Sat, Oct 12, 2024 at 6:39 AM Vadim Zeitlin <[email protected]> wrote:

> On Fri, 11 Oct 2024 19:15:55 -0500 Andre F wrote:
>
> AF> I'm trying to figure out why the text doesn't stay vertically centered
> AF> inside the box when I increase the size of the text.  The box clearly
> has
> AF> enough room, but the text starts to go out of view instead of staying
> AF> vertically centered.  I've tried various things, but am unable to keep
> it
> AF> centered.
> AF>
> AF> Can someone tell me what's wrong?
> AF>
> AF> cstm5_e_textCtrl = new wxTextCtrl(panel2, wxID_ANY, wxT(""),
> AF> wxDefaultPosition, wxSize(box_w, box_ht), wxNO_BORDER | wxTE_CENTER);
> AF> p2rowThree->Add(cstm5_e_textCtrl, 0, wxEXPAND | wxALL, 10);
>
>  What is p2rowThree, i.e. what kind of sizer is it? If it's a box sizer,
> you need to use a non-zero proportion to allow the text to expand at all.
>
> AF> contents << cstm_wrd[cstm_cnt];
> AF> wxFont font = textCtrl->GetFont();
> AF> font.SetWeight(wxFONTWEIGHT_NORMAL);
> AF> font.SetPointSize(boxtext_size);
> AF> textCtrl->SetFont(font);
>
>  In any case, setting the font doesn't result in a re-layout, so you have
> to call Layout() on some parent window containing this text control for the
> text size to change.
>
>  Regards,
> VZ
>
> --
> TT-Solutions: wxWidgets consultancy and technical support
>               https://www.tt-solutions.com/
>

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CANdLyG2YMKeJ3uwRMsy1sax68u40TFmJSXuMiT%3DD3K%3DEPQg5HQ%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.