Re: Ugh! I am having trouble visualizing sizers.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Ugh! I thought I had mastered sizers and off to my next challenge, FONTs.

But not quite, I am hung up on making horizontal unstretchable.
Why would we want the Buttons to be unstretchable?
I would want the Buttons to stretch Horizontaly, if I dragged the Frame Horizontally.
Can someone explain this? Thanks! ...V


Please, see: Figure 7-8 A simple dialog using sizers
at (btw: Thanks for this link. I downloaded it.)
http://dev.gentoo.org/dberkholz/articles/programming_with_wxwidgets.pdf

\\-- A dialog with a stretching text control 
\\MyDialog::MyDialog(**wx**Window *parent, **wx**WindowID id, 
\\const **wx**String &title ) 
\\: **wx**Dialog(parent, id, title, 
\\**wx**DefaultPosition, **wx**DefaultSize, 
\\**wx**DEFAULT_DIALOG_STYLE | **wx**RESIZE_BORDER) 
\\{ 
\\**wx**BoxSizer *topSizer = new **wx**BoxSizer( **wx**VERTICAL ); 
\\-- Create text ctrl with minimal size 100x60 
\\topSizer->Add( 
\\new **wx**TextCtrl( this, **wx**ID_ANY, “My text.”, 
\\**wx**DefaultPosition, **wx**Size(100,60), **wx**TE_MULTILINE), 
\\1, -- make vertically stretchable 
\\**wx**EXPAND| -- make horizontally stretchable 
\\**wx**ALL, -- and make border all around 
\\10 ); -- set border width to 10 
\\**wx**BoxSizer *buttonSizer = new **wx**BoxSizer( **wx**HORIZONTAL ); 
\\buttonSizer->Add( 
\\new **wx**Button( this, **wx**ID_OK, “OK” ), 
\\0, -- make horizontally **unstretchable** 
\\ 
\\**wx**ALL, -- make border all around: implicit top alignment 
\\10 ); -- set border width to 10 
\\buttonSizer->Add( 
\\new **wx**Button( this, **wx**ID_CANCEL, “Cancel” ), 
\\0, -- make horizontally **unstretchable** 
\\**wx**ALL, -- make border all around (implicit top alignment) 
\\10 ); -- set border width to 10 
\\topSizer->Add( 
\\buttonSizer, 
\\0, -- make vertically **unstretchable** 
\\**wx**ALIGN_CENTER ); -- no border and centre horizontally 
\\SetSizer( topSizer ); -- use the sizer for layout 
\\topSizer->Fit( this ); -- fit the dialog to the content 
\\SetSizer( topSizer ); // use the sizer for layout 
\\topSizer->Fit( this ); // fit the dialog to the content 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu