Page 1 of 1

minimal wxTextCtrl

Posted: Mon Jul 20, 2009 3:04 pm
by MoonKid
I want a wxTextCtrl with a minimal width. It should only be possible to display 3 characters in it.

But I am not able to decrease the with that way.

Just example code

Code: Select all

wxTextCtrl* pCtrl = new wxTextCtrl(this, wxID_ANY);
wxSize size = pCtrl->GetSize();
size.SetWidth(20); // just 20 pixel for example
pCtrl->SetMinSize(size);
SetWidth() has no effect. Setting it to 1000 has no effect, too.

I want to modify the width of a wxTextCtrl. How can I do that?

Posted: Mon Jul 20, 2009 3:36 pm
by DavidHart
Hi,

Minimum means "This size or bigger". Try wxWindow::SetMaxSize.

Regards,

David

Posted: Mon Jul 20, 2009 5:47 pm
by MoonKid
DavidHart wrote:Try wxWindow::SetMaxSize.
I used SetMaxSize() but it is not possible to set the width less then the default width of a textctrl.

Posted: Mon Jul 20, 2009 6:24 pm
by DavidHart
No, it doesn't seem to like it, does it.

SetClientSize() works for me, though; and it's closer to what you'd want anyway.

Posted: Thu Jul 23, 2009 9:10 am
by MoonKid
Only the combination of SetSize() and wxSizerFlags(0).FixedMinSize() has success.