1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Layout sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ----------------------------------------------------------------------------
14 // ----------------------------------------------------------------------------
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
27 #if !wxUSE_CONSTRAINTS
28 #error You must set wxUSE_CONSTRAINTS to 1 in setup.h!
32 #include "wx/gbsizer.h"
33 #include "wx/statline.h"
34 #include "wx/notebook.h"
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
50 // Create the main frame window
51 MyFrame
*frame
= new MyFrame
;
58 // ----------------------------------------------------------------------------
60 // ----------------------------------------------------------------------------
62 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
63 EVT_MENU(LAYOUT_ABOUT
, MyFrame::OnAbout
)
64 EVT_MENU(LAYOUT_QUIT
, MyFrame::OnQuit
)
66 EVT_MENU(LAYOUT_TEST_CONSTRAINTS
, MyFrame::TestConstraints
)
67 EVT_MENU(LAYOUT_TEST_SIZER
, MyFrame::TestFlexSizers
)
68 EVT_MENU(LAYOUT_TEST_NB_SIZER
, MyFrame::TestNotebookSizers
)
69 EVT_MENU(LAYOUT_TEST_GB_SIZER
, MyFrame::TestGridBagSizer
)
72 // Define my frame constructor
74 : wxFrame(NULL
, -1, _T("wxWindows Layout Demo"),
75 wxDefaultPosition
, wxDefaultSize
,
76 wxDEFAULT_FRAME_STYLE
| wxNO_FULL_REPAINT_ON_RESIZE
)
79 wxMenu
*file_menu
= new wxMenu
;
81 file_menu
->Append(LAYOUT_TEST_CONSTRAINTS
, _T("Test &constraints"));
82 file_menu
->Append(LAYOUT_TEST_SIZER
, _T("Test wx&FlexSizer"));
83 file_menu
->Append(LAYOUT_TEST_NB_SIZER
, _T("&Test notebook sizers"));
84 file_menu
->Append(LAYOUT_TEST_GB_SIZER
, _T("Test &gridbag sizer"));
86 file_menu
->AppendSeparator();
87 file_menu
->Append(LAYOUT_QUIT
, _T("E&xit"), _T("Quit program"));
89 wxMenu
*help_menu
= new wxMenu
;
90 help_menu
->Append(LAYOUT_ABOUT
, _T("&About"), _T("About layout demo"));
92 wxMenuBar
*menu_bar
= new wxMenuBar
;
94 menu_bar
->Append(file_menu
, _T("&File"));
95 menu_bar
->Append(help_menu
, _T("&Help"));
97 // Associate the menu bar with the frame
101 SetStatusText(_T("wxWindows layout demo"));
104 // we want to get a dialog that is stretchable because it
105 // has a text ctrl in the middle. at the bottom, we have
106 // two buttons which.
108 wxBoxSizer
*topsizer
= new wxBoxSizer( wxVERTICAL
);
110 // 1) top: create wxStaticText with minimum size equal to its default size
112 new wxStaticText( this, -1, _T("An explanation (wxALIGN_RIGHT).") ),
113 0, // make vertically unstretchable
114 wxALIGN_RIGHT
| // right align text
115 wxTOP
| wxLEFT
| wxRIGHT
, // make border all around except wxBOTTOM
116 5 ); // set border width to 5
118 // 2) top: create wxTextCtrl with minimum size (100x60)
120 new wxTextCtrl( this, -1, _T("My text (wxEXPAND)."), wxDefaultPosition
, wxSize(100,60), wxTE_MULTILINE
),
121 1, // make vertically stretchable
122 wxEXPAND
| // make horizontally stretchable
123 wxALL
, // and make border all around
124 5 ); // set border width to 5
126 // 2.5) Gratuitous test of wxStaticBoxSizers
127 wxBoxSizer
*statsizer
= new wxStaticBoxSizer(
128 new wxStaticBox(this, -1, _T("A wxStaticBoxSizer")),
131 new wxStaticText(this, -1, _T("And some TEXT inside it")),
136 topsizer
->Add(statsizer
, 1, wxEXPAND
| wxALL
, 10);
138 // 2.7) And a test of wxGridSizer
139 wxGridSizer
*gridsizer
= new wxGridSizer(2, 5, 5);
140 gridsizer
->Add(new wxStaticText(this, -1, _T("Label")), 0,
141 wxALIGN_RIGHT
| wxALIGN_CENTER_VERTICAL
);
142 gridsizer
->Add(new wxTextCtrl(this, -1, _T("Grid sizer demo")), 1,
143 wxGROW
| wxALIGN_CENTER_VERTICAL
);
144 gridsizer
->Add(new wxStaticText(this, -1, _T("Another label")), 0,
145 wxALIGN_RIGHT
| wxALIGN_CENTER_VERTICAL
);
146 gridsizer
->Add(new wxTextCtrl(this, -1, _T("More text")), 1,
147 wxGROW
| wxALIGN_CENTER_VERTICAL
);
148 gridsizer
->Add(new wxStaticText(this, -1, _T("Final label")), 0,
149 wxALIGN_RIGHT
| wxALIGN_CENTER_VERTICAL
);
150 gridsizer
->Add(new wxTextCtrl(this, -1, _T("And yet more text")), 1,
151 wxGROW
| wxALIGN_CENTER_VERTICAL
);
152 topsizer
->Add(gridsizer
, 1, wxGROW
| wxALL
, 10);
155 // 3) middle: create wxStaticLine with minimum size (3x3)
157 new wxStaticLine( this, -1, wxDefaultPosition
, wxSize(3,3), wxHORIZONTAL
),
158 0, // make vertically unstretchable
159 wxEXPAND
| // make horizontally stretchable
160 wxALL
, // and make border all around
161 5 ); // set border width to 5
164 // 4) bottom: create two centred wxButtons
165 wxBoxSizer
*button_box
= new wxBoxSizer( wxHORIZONTAL
);
167 new wxButton( this, -1, _T("Two buttons in a box") ),
168 0, // make horizontally unstretchable
169 wxALL
, // make border all around
170 7 ); // set border width to 7
172 new wxButton( this, -1, _T("(wxCENTER)") ),
173 0, // make horizontally unstretchable
174 wxALL
, // make border all around
175 7 ); // set border width to 7
179 0, // make vertically unstretchable
180 wxCENTER
); // no border and centre horizontally
182 // don't allow frame to get smaller than what the sizers tell it and also set
183 // the initial size as calculated by the sizers
184 topsizer
->SetSizeHints( this );
186 SetSizer( topsizer
);
189 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
) )
194 void MyFrame::TestConstraints(wxCommandEvent
& WXUNUSED(event
) )
197 newFrame
= new MyConstraintsFrame(_T("Constraints Test Frame"), 100, 100);
198 newFrame
->Show(TRUE
);
201 void MyFrame::TestFlexSizers(wxCommandEvent
& WXUNUSED(event
) )
203 MyFlexSizerFrame
*newFrame
= new MyFlexSizerFrame(_T("Flex Sizer Test Frame"), 50, 50);
204 newFrame
->Show(TRUE
);
207 void MyFrame::TestNotebookSizers(wxCommandEvent
& WXUNUSED(event
) )
209 MySizerDialog
dialog( this, _T("Notebook Sizer Test Dialog") );
215 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
) )
217 (void)wxMessageBox(_T("wxWindows GUI library layout demo\n"),
218 _T("About Layout Demo"), wxOK
|wxICON_INFORMATION
);
221 void MyFrame::TestGridBagSizer(wxCommandEvent
& WXUNUSED(event
) )
223 MyGridBagSizerFrame
*newFrame
= new
224 MyGridBagSizerFrame(_T("wxGridBagSizer Test Frame"), 50, 50);
225 newFrame
->Show(TRUE
);
229 // ----------------------------------------------------------------------------
230 // MyConstraintsFrame
231 // ----------------------------------------------------------------------------
233 MyConstraintsFrame::MyConstraintsFrame(const wxChar
*title
, int x
, int y
)
234 : wxFrame(NULL
, -1, title
, wxPoint(x
, y
) )
237 wxPanel
*panel
= new wxPanel(this);
239 // Create some panel items
240 wxButton
*btn1
= new wxButton(panel
, -1, _T("A button (1)")) ;
242 wxLayoutConstraints
*b1
= new wxLayoutConstraints
;
243 b1
->centreX
.SameAs (panel
, wxCentreX
);
244 b1
->top
.SameAs (panel
, wxTop
, 5);
245 b1
->width
.PercentOf (panel
, wxWidth
, 80);
247 btn1
->SetConstraints(b1
);
249 wxListBox
*list
= new wxListBox(panel
, -1,
250 wxPoint(-1, -1), wxSize(200, 100));
251 list
->Append(_T("Apple"));
252 list
->Append(_T("Pear"));
253 list
->Append(_T("Orange"));
254 list
->Append(_T("Banana"));
255 list
->Append(_T("Fruit"));
257 wxLayoutConstraints
*b2
= new wxLayoutConstraints
;
258 b2
->top
.Below (btn1
, 5);
259 b2
->left
.SameAs (panel
, wxLeft
, 5);
260 b2
->width
.PercentOf (panel
, wxWidth
, 40);
261 b2
->bottom
.SameAs (panel
, wxBottom
, 5);
262 list
->SetConstraints(b2
);
264 wxTextCtrl
*mtext
= new wxTextCtrl(panel
, -1,
265 _T("This frame is laid out using\nconstraints, but the preferred\nlayout mechanism now are sizers."),
270 wxLayoutConstraints
*b3
= new wxLayoutConstraints
;
271 b3
->top
.Below (btn1
, 5);
272 b3
->left
.RightOf (list
, 5);
273 b3
->right
.SameAs (panel
, wxRight
, 5);
274 b3
->bottom
.SameAs (panel
, wxBottom
, 5);
275 mtext
->SetConstraints(b3
);
277 wxTextCtrl
*canvas
= new wxTextCtrl(this, -1, _T("yet another window"));
279 // Make a text window
280 wxTextCtrl
*text_window
= new wxTextCtrl(this, -1, _T(""),
285 // Set constraints for panel subwindow
286 wxLayoutConstraints
*c1
= new wxLayoutConstraints
;
288 c1
->left
.SameAs (this, wxLeft
);
289 c1
->top
.SameAs (this, wxTop
);
290 c1
->right
.PercentOf (this, wxWidth
, 50);
291 c1
->height
.PercentOf (this, wxHeight
, 50);
293 panel
->SetConstraints(c1
);
295 // Set constraints for canvas subwindow
296 wxLayoutConstraints
*c2
= new wxLayoutConstraints
;
298 c2
->left
.SameAs (panel
, wxRight
);
299 c2
->top
.SameAs (this, wxTop
);
300 c2
->right
.SameAs (this, wxRight
);
301 c2
->height
.PercentOf (this, wxHeight
, 50);
303 canvas
->SetConstraints(c2
);
305 // Set constraints for text subwindow
306 wxLayoutConstraints
*c3
= new wxLayoutConstraints
;
307 c3
->left
.SameAs (this, wxLeft
);
308 c3
->top
.Below (panel
);
309 c3
->right
.SameAs (this, wxRight
);
310 c3
->bottom
.SameAs (this, wxBottom
);
312 text_window
->SetConstraints(c3
);
317 // ----------------------------------------------------------------------------
319 // ----------------------------------------------------------------------------
321 void MyFlexSizerFrame::InitFlexSizer(wxFlexGridSizer
*sizer
)
323 for ( int i
= 0; i
< 3; i
++ )
325 for ( int j
= 0; j
< 3; j
++ )
327 sizer
->Add(new wxStaticText
331 wxString::Format(_T("(%d, %d)"), i
+ 1, j
+ 1),
336 0, wxEXPAND
| wxALIGN_CENTER_VERTICAL
| wxALL
, 3);
341 MyFlexSizerFrame::MyFlexSizerFrame(const wxChar
*title
, int x
, int y
)
342 : wxFrame(NULL
, -1, title
, wxPoint(x
, y
) )
344 wxFlexGridSizer
*sizerFlex
;
346 // consttuct the first column
347 wxSizer
*sizerCol1
= new wxBoxSizer(wxVERTICAL
);
348 sizerCol1
->Add(new wxStaticText(this, -1, _T("Ungrowable:")), 0, wxCENTER
| wxTOP
, 20);
349 sizerFlex
= new wxFlexGridSizer(3, 3);
350 InitFlexSizer(sizerFlex
);
351 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
353 sizerCol1
->Add(new wxStaticText(this, -1, _T("Growable middle column:")), 0, wxCENTER
| wxTOP
, 20);
354 sizerFlex
= new wxFlexGridSizer(3, 3);
355 InitFlexSizer(sizerFlex
);
356 sizerFlex
->AddGrowableCol(1);
357 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
359 sizerCol1
->Add(new wxStaticText(this, -1, _T("Growable middle row:")), 0, wxCENTER
| wxTOP
, 20);
360 sizerFlex
= new wxFlexGridSizer(3, 3);
361 InitFlexSizer(sizerFlex
);
362 sizerFlex
->AddGrowableRow(1);
363 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
365 sizerCol1
->Add(new wxStaticText(this, -1, _T("All growable columns:")), 0, wxCENTER
| wxTOP
, 20);
366 sizerFlex
= new wxFlexGridSizer(3, 3);
367 InitFlexSizer(sizerFlex
);
368 sizerFlex
->AddGrowableCol(0, 1);
369 sizerFlex
->AddGrowableCol(1, 2);
370 sizerFlex
->AddGrowableCol(2, 3);
371 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
374 wxSizer
*sizerCol2
= new wxBoxSizer(wxVERTICAL
);
375 sizerCol2
->Add(new wxStaticText(this, -1, _T("Growable middle row and column:")), 0, wxCENTER
| wxTOP
, 20);
376 sizerFlex
= new wxFlexGridSizer(3, 3);
377 InitFlexSizer(sizerFlex
);
378 sizerFlex
->AddGrowableCol(1);
379 sizerFlex
->AddGrowableRow(1);
380 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
382 sizerCol2
->Add(new wxStaticText(this, -1, _T("Same with horz flex direction")), 0, wxCENTER
| wxTOP
, 20);
383 sizerFlex
= new wxFlexGridSizer(3, 3);
384 InitFlexSizer(sizerFlex
);
385 sizerFlex
->AddGrowableCol(1);
386 sizerFlex
->AddGrowableRow(1);
387 sizerFlex
->SetFlexibleDirection(wxHORIZONTAL
);
388 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
390 sizerCol2
->Add(new wxStaticText(this, -1, _T("Same with grow mode == \"none\"")), 0, wxCENTER
| wxTOP
, 20);
391 sizerFlex
= new wxFlexGridSizer(3, 3);
392 InitFlexSizer(sizerFlex
);
393 sizerFlex
->AddGrowableCol(1);
394 sizerFlex
->AddGrowableRow(1);
395 sizerFlex
->SetFlexibleDirection(wxHORIZONTAL
);
396 sizerFlex
->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_NONE
);
397 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
399 sizerCol2
->Add(new wxStaticText(this, -1, _T("Same with grow mode == \"all\"")), 0, wxCENTER
| wxTOP
, 20);
400 sizerFlex
= new wxFlexGridSizer(3, 3);
401 InitFlexSizer(sizerFlex
);
402 sizerFlex
->AddGrowableCol(1);
403 sizerFlex
->AddGrowableRow(1);
404 sizerFlex
->SetFlexibleDirection(wxHORIZONTAL
);
405 sizerFlex
->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_ALL
);
406 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
408 // add both columns to grid sizer
409 wxGridSizer
*sizerTop
= new wxGridSizer(2, 0, 20);
410 sizerTop
->Add(sizerCol1
, 1, wxEXPAND
);
411 sizerTop
->Add(sizerCol2
, 1, wxEXPAND
);
414 sizerTop
->SetSizeHints(this);
417 // ----------------------------------------------------------------------------
419 // ----------------------------------------------------------------------------
421 MySizerDialog::MySizerDialog(wxWindow
*parent
, const wxChar
*title
)
422 : wxDialog(parent
, -1, wxString(title
))
424 // Begin with first hierarchy: a notebook at the top and
425 // and OK button at the bottom.
427 wxBoxSizer
*topsizer
= new wxBoxSizer( wxVERTICAL
);
429 wxNotebook
*notebook
= new wxNotebook( this, -1 );
430 wxNotebookSizer
*nbs
= new wxNotebookSizer( notebook
);
431 topsizer
->Add( nbs
, 1, wxGROW
);
433 wxButton
*button
= new wxButton( this, wxID_OK
, _T("OK") );
434 topsizer
->Add( button
, 0, wxALIGN_RIGHT
| wxALL
, 10 );
436 // First page: one big text ctrl
437 wxTextCtrl
*multi
= new wxTextCtrl( notebook
, -1, _T("TextCtrl."), wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
);
438 notebook
->AddPage( multi
, _T("Page One") );
440 // Second page: a text ctrl and a button
441 wxPanel
*panel
= new wxPanel( notebook
, -1 );
442 notebook
->AddPage( panel
, _T("Page Two") );
444 wxSizer
*panelsizer
= new wxBoxSizer( wxVERTICAL
);
446 wxTextCtrl
*text
= new wxTextCtrl( panel
, -1, _T("TextLine 1."), wxDefaultPosition
, wxSize(250,-1) );
447 panelsizer
->Add( text
, 0, wxGROW
|wxALL
, 30 );
448 text
= new wxTextCtrl( panel
, -1, _T("TextLine 2."), wxDefaultPosition
, wxSize(250,-1) );
449 panelsizer
->Add( text
, 0, wxGROW
|wxALL
, 30 );
450 wxButton
*button2
= new wxButton( panel
, -1, _T("Hallo") );
451 panelsizer
->Add( button2
, 0, wxALIGN_RIGHT
| wxLEFT
|wxRIGHT
|wxBOTTOM
, 30 );
453 panel
->SetAutoLayout( TRUE
);
454 panel
->SetSizer( panelsizer
);
456 // Tell dialog to use sizer
457 SetSizer( topsizer
);
458 topsizer
->SetSizeHints( this );
461 // ----------------------------------------------------------------------------
462 // MyGridBagSizerFrame
463 // ----------------------------------------------------------------------------
465 // some simple macros to help make the sample code below more clear
466 #define TEXTCTRL(text) new wxTextCtrl(p, -1, _T(text))
467 #define MLTEXTCTRL(text) new wxTextCtrl(p, -1, _T(text), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE)
468 #define POS(r, c) wxGBPosition(r,c)
469 #define SPAN(r, c) wxGBSpan(r,c)
471 wxChar
* gbsDescription
=_T("\
472 The wxGridBagSizer is similar to the wxFlexGridSizer except the items are explicitly positioned\n\
473 in a virtual cell of the layout grid, and column or row spanning is allowed. For example, this\n\
474 static text is positioned at (0,0) and it spans 7 columns.");
488 BEGIN_EVENT_TABLE(MyGridBagSizerFrame
, wxFrame
)
489 EVT_BUTTON( GBS_HIDE_BTN
, MyGridBagSizerFrame::OnHideBtn
)
490 EVT_BUTTON( GBS_SHOW_BTN
, MyGridBagSizerFrame::OnShowBtn
)
491 EVT_BUTTON( GBS_MOVE_BTN1
, MyGridBagSizerFrame::OnMoveBtn
)
492 EVT_BUTTON( GBS_MOVE_BTN2
, MyGridBagSizerFrame::OnMoveBtn
)
496 MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar
*title
, int x
, int y
)
497 : wxFrame( NULL
, -1, title
, wxPoint(x
, y
) )
499 wxPanel
* p
= new wxPanel(this, -1);
501 m_gbs
= new wxGridBagSizer();
504 m_gbs
->Add( new wxStaticText(p
, -1, gbsDescription
),
505 POS(0,0), SPAN(1, 7),
506 wxALIGN_CENTER
| wxALL
, 5);
508 m_gbs
->Add( TEXTCTRL("pos(1,0)"), POS(1,0) );
509 m_gbs
->Add( TEXTCTRL("pos(1,1)"), POS(1,1) );
510 m_gbs
->Add( TEXTCTRL("pos(2,0)"), POS(2,0) );
511 m_gbs
->Add( TEXTCTRL("pos(2,1)"), POS(2,1) );
512 m_gbs
->Add( MLTEXTCTRL("pos(3,2), span(1,2)\nthis row and col are growable"),
513 POS(3,2), SPAN(1,2), wxEXPAND
);
514 m_gbs
->Add( MLTEXTCTRL("pos(4,3)\nspan(3,1)"),
515 POS(4,3), SPAN(3,1), wxEXPAND
);
516 m_gbs
->Add( TEXTCTRL("pos(5,4)"), POS(5,4), wxDefaultSpan
, wxEXPAND
);
517 m_gbs
->Add( TEXTCTRL("pos(6,5)"), POS(6,5), wxDefaultSpan
, wxEXPAND
);
518 m_gbs
->Add( TEXTCTRL("pos(7,6)"), POS(7,6) );
520 //m_gbs->Add( TEXTCTRL("bad position"), POS(4,3) ); // Test for assert
521 //m_gbs->Add( TEXTCTRL("bad position"), POS(5,3) ); // Test for assert
524 m_moveBtn1
= new wxButton(p
, GBS_MOVE_BTN1
, _T("Move this to (3,6)"));
525 m_moveBtn2
= new wxButton(p
, GBS_MOVE_BTN2
, _T("Move this to (3,6)"));
526 m_gbs
->Add( m_moveBtn1
, POS(10,2) );
527 m_gbs
->Add( m_moveBtn2
, POS(10,3) );
529 m_hideBtn
= new wxButton(p
, GBS_HIDE_BTN
, _T("Hide this item -->"));
530 m_gbs
->Add(m_hideBtn
, POS(12, 3));
532 m_hideTxt
= new wxTextCtrl(p
, -1, _T("pos(12,4), size(150, -1)"),
533 wxDefaultPosition
, wxSize(150,-1));
534 m_gbs
->Add( m_hideTxt
, POS(12,4) );
536 m_showBtn
= new wxButton(p
, GBS_SHOW_BTN
, _T("<-- Show it again"));
537 m_gbs
->Add(m_showBtn
, POS(12, 5));
538 m_showBtn
->Disable();
540 m_gbs
->Add(10,10, POS(14,0));
542 m_gbs
->AddGrowableRow(3);
543 m_gbs
->AddGrowableCol(2);
545 p
->SetSizerAndFit(m_gbs
);
546 SetClientSize(p
->GetSize());
550 void MyGridBagSizerFrame::OnHideBtn(wxCommandEvent
&)
552 m_gbs
->Hide(m_hideTxt
);
553 m_hideBtn
->Disable();
558 void MyGridBagSizerFrame::OnShowBtn(wxCommandEvent
&)
560 m_gbs
->Show(m_hideTxt
);
562 m_showBtn
->Disable();
567 void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent
& event
)
569 wxButton
* btn
= (wxButton
*)event
.GetEventObject();
570 wxGBPosition curPos
= m_gbs
->GetItemPosition(btn
);
572 // if it's already at the "other" spot then move it back
573 if (curPos
== wxGBPosition(3,6))
575 m_gbs
->SetItemPosition(btn
, m_lastPos
);
576 btn
->SetLabel(_T("Move this to (3,6)"));
580 if ( m_gbs
->CheckForIntersection(wxGBPosition(3,6), wxGBSpan(1,1)) )
582 _T("wxGridBagSizer will not allow items to be in the same cell as\n\
583 another item, so this operation will fail. You will also get an assert\n\
584 when compiled in debug mode."), _T("Warning"), wxOK
| wxICON_INFORMATION
);
586 if ( m_gbs
->SetItemPosition(btn
, wxGBPosition(3,6)) )
589 btn
->SetLabel(_T("Move it back"));