Anyway thanks in advance.
Anna
Here is the piece of source code:
//! creates the new widget and sets its description
wxStaticText* unitWidget = new wxStaticText(parent, -1,
parameter.getName().c_str(),
wxPoint(-1,-1),
wxSize(150, -1),
wxTE_MULTILINE|wxTE_WORDWRAP|wxST_NO_AUTORESIZE);
unitWidget->SetBackgroundColour(parent->GetBackgroundColour());
//! adds tooltip and sets alignment of the new widget
unitWidget->SetToolTip( parameter.getDescription().c_str() );
//! for esthetic's sake set a fixed width but allow the word wrapping
unitWidget->SetSize(-1, -1, 110, -1,wxSIZE_USE_EXISTING );
unitWidget->Fit();
unitWidget->Show();
std::list<CBaseComponent*> widgList;
On Thu, 03 Mar 2005 12:23:40 +0100, Anna Maria Picciau <p...@iis.fraunhofer.de> wrote:Hi everybody! I'm trying to create a label for a text which could be longer than the label itself, in which case it should be wrapped at the end of the word. I have almost succeded, but the height of my label remains the same, so that the text is not displayed properly. Maye someone of you knows which mistake I am making....
I think wxStaticText wraps automatically, if you make it big enough.
This works for me:
m_text = new wxStaticText(panel, -1, wxT("This text can wrap"),
wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE);
m_text->SetSizeHints(100, 30, -1, -1, -1, -1);
May not be a good idea to hard-code a specific height (30 pixels in
that example). If your text control is in a sizer, just give it a
nonzero proportion and make it expandable with wxEXPAND.
Cheers,
--
David Norris
dano...@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-u...@lists.wxwidgets.org
For additional commands, e-mail: wx-use...@lists.wxwidgets.org
I think wxStaticText wraps automatically, if you make it big enough.
here is my code:
void CGuiBuilder::s_setGroup(CIISPanel* panel, bool group)
{
if (group)
{
wxStaticBox* sbox = new wxStaticBox(panel, -1, panel->GetName(),
wxPoint(15, 15), wxSize(wxDefaultSize));
wxStaticBoxSizer* ssizer = new wxStaticBoxSizer(sbox, wxVERTICAL);
ssizer->Add(panel,1, wxGROW|wxALL);
// panel->SetSizer(ssizer);
panel->setInternLayout(ssizer);
panel->SetAutoLayout( TRUE );
ssizer->Fit( panel );
ssizer->SetSizeHints( panel);
}
}
It seems to me that if you're letting the user specify the height of
the box, and the user decides to give a height that's too small for
two lines of text, then surely that's the user's problem? What exact
behavior are you trying to get?
--
David Norris
dano...@gmail.com