minimal wxTextCtrl Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

minimal wxTextCtrl

Post 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?
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi,

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

Regards,

David
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

Post 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.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post 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.
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

Post by MoonKid »

Only the combination of SetSize() and wxSizerFlags(0).FixedMinSize() has success.
Post Reply