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\n"
266 "constraints, but the preferred\n"
267 "layout mechanism now are sizers."),
272 wxLayoutConstraints
*b3
= new wxLayoutConstraints
;
273 b3
->top
.Below (btn1
, 5);
274 b3
->left
.RightOf (list
, 5);
275 b3
->right
.SameAs (panel
, wxRight
, 5);
276 b3
->bottom
.SameAs (panel
, wxBottom
, 5);
277 mtext
->SetConstraints(b3
);
279 wxTextCtrl
*canvas
= new wxTextCtrl(this, -1, _T("yet another window"));
281 // Make a text window
282 wxTextCtrl
*text_window
= new wxTextCtrl(this, -1, _T(""),
287 // Set constraints for panel subwindow
288 wxLayoutConstraints
*c1
= new wxLayoutConstraints
;
290 c1
->left
.SameAs (this, wxLeft
);
291 c1
->top
.SameAs (this, wxTop
);
292 c1
->right
.PercentOf (this, wxWidth
, 50);
293 c1
->height
.PercentOf (this, wxHeight
, 50);
295 panel
->SetConstraints(c1
);
297 // Set constraints for canvas subwindow
298 wxLayoutConstraints
*c2
= new wxLayoutConstraints
;
300 c2
->left
.SameAs (panel
, wxRight
);
301 c2
->top
.SameAs (this, wxTop
);
302 c2
->right
.SameAs (this, wxRight
);
303 c2
->height
.PercentOf (this, wxHeight
, 50);
305 canvas
->SetConstraints(c2
);
307 // Set constraints for text subwindow
308 wxLayoutConstraints
*c3
= new wxLayoutConstraints
;
309 c3
->left
.SameAs (this, wxLeft
);
310 c3
->top
.Below (panel
);
311 c3
->right
.SameAs (this, wxRight
);
312 c3
->bottom
.SameAs (this, wxBottom
);
314 text_window
->SetConstraints(c3
);
319 // ----------------------------------------------------------------------------
321 // ----------------------------------------------------------------------------
323 void MyFlexSizerFrame::InitFlexSizer(wxFlexGridSizer
*sizer
)
325 for ( int i
= 0; i
< 3; i
++ )
327 for ( int j
= 0; j
< 3; j
++ )
329 sizer
->Add(new wxStaticText
333 wxString::Format(_T("(%d, %d)"), i
+ 1, j
+ 1),
338 0, wxEXPAND
| wxALIGN_CENTER_VERTICAL
| wxALL
, 3);
343 MyFlexSizerFrame::MyFlexSizerFrame(const wxChar
*title
, int x
, int y
)
344 : wxFrame(NULL
, -1, title
, wxPoint(x
, y
) )
346 wxFlexGridSizer
*sizerFlex
;
348 // consttuct the first column
349 wxSizer
*sizerCol1
= new wxBoxSizer(wxVERTICAL
);
350 sizerCol1
->Add(new wxStaticText(this, -1, _T("Ungrowable:")), 0, wxCENTER
| wxTOP
, 20);
351 sizerFlex
= new wxFlexGridSizer(3, 3);
352 InitFlexSizer(sizerFlex
);
353 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
355 sizerCol1
->Add(new wxStaticText(this, -1, _T("Growable middle column:")), 0, wxCENTER
| wxTOP
, 20);
356 sizerFlex
= new wxFlexGridSizer(3, 3);
357 InitFlexSizer(sizerFlex
);
358 sizerFlex
->AddGrowableCol(1);
359 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
361 sizerCol1
->Add(new wxStaticText(this, -1, _T("Growable middle row:")), 0, wxCENTER
| wxTOP
, 20);
362 sizerFlex
= new wxFlexGridSizer(3, 3);
363 InitFlexSizer(sizerFlex
);
364 sizerFlex
->AddGrowableRow(1);
365 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
367 sizerCol1
->Add(new wxStaticText(this, -1, _T("All growable columns:")), 0, wxCENTER
| wxTOP
, 20);
368 sizerFlex
= new wxFlexGridSizer(3, 3);
369 InitFlexSizer(sizerFlex
);
370 sizerFlex
->AddGrowableCol(0, 1);
371 sizerFlex
->AddGrowableCol(1, 2);
372 sizerFlex
->AddGrowableCol(2, 3);
373 sizerCol1
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
376 wxSizer
*sizerCol2
= new wxBoxSizer(wxVERTICAL
);
377 sizerCol2
->Add(new wxStaticText(this, -1, _T("Growable middle row and column:")), 0, wxCENTER
| wxTOP
, 20);
378 sizerFlex
= new wxFlexGridSizer(3, 3);
379 InitFlexSizer(sizerFlex
);
380 sizerFlex
->AddGrowableCol(1);
381 sizerFlex
->AddGrowableRow(1);
382 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
384 sizerCol2
->Add(new wxStaticText(this, -1, _T("Same with horz flex direction")), 0, wxCENTER
| wxTOP
, 20);
385 sizerFlex
= new wxFlexGridSizer(3, 3);
386 InitFlexSizer(sizerFlex
);
387 sizerFlex
->AddGrowableCol(1);
388 sizerFlex
->AddGrowableRow(1);
389 sizerFlex
->SetFlexibleDirection(wxHORIZONTAL
);
390 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
392 sizerCol2
->Add(new wxStaticText(this, -1, _T("Same with grow mode == \"none\"")), 0, wxCENTER
| wxTOP
, 20);
393 sizerFlex
= new wxFlexGridSizer(3, 3);
394 InitFlexSizer(sizerFlex
);
395 sizerFlex
->AddGrowableCol(1);
396 sizerFlex
->AddGrowableRow(1);
397 sizerFlex
->SetFlexibleDirection(wxHORIZONTAL
);
398 sizerFlex
->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_NONE
);
399 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
401 sizerCol2
->Add(new wxStaticText(this, -1, _T("Same with grow mode == \"all\"")), 0, wxCENTER
| wxTOP
, 20);
402 sizerFlex
= new wxFlexGridSizer(3, 3);
403 InitFlexSizer(sizerFlex
);
404 sizerFlex
->AddGrowableCol(1);
405 sizerFlex
->AddGrowableRow(1);
406 sizerFlex
->SetFlexibleDirection(wxHORIZONTAL
);
407 sizerFlex
->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_ALL
);
408 sizerCol2
->Add(sizerFlex
, 1, wxALL
| wxEXPAND
, 10);
410 // add both columns to grid sizer
411 wxGridSizer
*sizerTop
= new wxGridSizer(2, 0, 20);
412 sizerTop
->Add(sizerCol1
, 1, wxEXPAND
);
413 sizerTop
->Add(sizerCol2
, 1, wxEXPAND
);
416 sizerTop
->SetSizeHints(this);
419 // ----------------------------------------------------------------------------
421 // ----------------------------------------------------------------------------
423 MySizerDialog::MySizerDialog(wxWindow
*parent
, const wxChar
*title
)
424 : wxDialog(parent
, -1, wxString(title
))
426 // Begin with first hierarchy: a notebook at the top and
427 // and OK button at the bottom.
429 wxBoxSizer
*topsizer
= new wxBoxSizer( wxVERTICAL
);
431 wxNotebook
*notebook
= new wxNotebook( this, -1 );
432 wxNotebookSizer
*nbs
= new wxNotebookSizer( notebook
);
433 topsizer
->Add( nbs
, 1, wxGROW
);
435 wxButton
*button
= new wxButton( this, wxID_OK
, _T("OK") );
436 topsizer
->Add( button
, 0, wxALIGN_RIGHT
| wxALL
, 10 );
438 // First page: one big text ctrl
439 wxTextCtrl
*multi
= new wxTextCtrl( notebook
, -1, _T("TextCtrl."), wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
);
440 notebook
->AddPage( multi
, _T("Page One") );
442 // Second page: a text ctrl and a button
443 wxPanel
*panel
= new wxPanel( notebook
, -1 );
444 notebook
->AddPage( panel
, _T("Page Two") );
446 wxSizer
*panelsizer
= new wxBoxSizer( wxVERTICAL
);
448 wxTextCtrl
*text
= new wxTextCtrl( panel
, -1, _T("TextLine 1."), wxDefaultPosition
, wxSize(250,-1) );
449 panelsizer
->Add( text
, 0, wxGROW
|wxALL
, 30 );
450 text
= new wxTextCtrl( panel
, -1, _T("TextLine 2."), wxDefaultPosition
, wxSize(250,-1) );
451 panelsizer
->Add( text
, 0, wxGROW
|wxALL
, 30 );
452 wxButton
*button2
= new wxButton( panel
, -1, _T("Hallo") );
453 panelsizer
->Add( button2
, 0, wxALIGN_RIGHT
| wxLEFT
|wxRIGHT
|wxBOTTOM
, 30 );
455 panel
->SetAutoLayout( TRUE
);
456 panel
->SetSizer( panelsizer
);
458 // Tell dialog to use sizer
459 SetSizer( topsizer
);
460 topsizer
->SetSizeHints( this );
463 // ----------------------------------------------------------------------------
464 // MyGridBagSizerFrame
465 // ----------------------------------------------------------------------------
467 // some simple macros to help make the sample code below more clear
468 #define TEXTCTRL(text) new wxTextCtrl(p, -1, wxT(text))
469 #define MLTEXTCTRL(text) new wxTextCtrl(p, -1, wxT(text), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE)
470 #define POS(r, c) wxGBPosition(r,c)
471 #define SPAN(r, c) wxGBSpan(r,c)
473 wxChar
* gbsDescription
=wxT("\
474 The wxGridBagSizer is similar to the wxFlexGridSizer except the \
475 items are explicitly posisioned in a virtual 'cell' in the \n\
476 layout grid, and column or row spanning is allowed. For example, \
477 this static text is positioned at (0,0) and it spans 9 columns.");
491 BEGIN_EVENT_TABLE(MyGridBagSizerFrame
, wxFrame
)
492 EVT_BUTTON( GBS_HIDE_BTN
, MyGridBagSizerFrame::OnHideBtn
)
493 EVT_BUTTON( GBS_SHOW_BTN
, MyGridBagSizerFrame::OnShowBtn
)
494 EVT_BUTTON( GBS_MOVE_BTN1
, MyGridBagSizerFrame::OnMoveBtn
)
495 EVT_BUTTON( GBS_MOVE_BTN2
, MyGridBagSizerFrame::OnMoveBtn
)
499 MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar
*title
, int x
, int y
)
500 : wxFrame( NULL
, -1, title
, wxPoint(x
, y
) )
502 wxPanel
* p
= new wxPanel(this, -1);
504 m_gbs
= new wxGridBagSizer();
507 m_gbs
->Add( new wxStaticText(p
, -1, gbsDescription
),
508 POS(0,0), SPAN(1, 9),
509 wxALIGN_CENTER
| wxALL
, 5);
511 m_gbs
->Add( TEXTCTRL("pos(1,0)"), POS(1,0) );
512 m_gbs
->Add( TEXTCTRL("pos(1,1)"), POS(1,1) );
513 m_gbs
->Add( TEXTCTRL("pos(2,0)"), POS(2,0) );
514 m_gbs
->Add( TEXTCTRL("pos(2,1)"), POS(2,1) );
515 m_gbs
->Add( MLTEXTCTRL("pos(3,2), span(1,2)\nthis row and col are growable"),
516 POS(3,2), SPAN(1,2), wxEXPAND
);
517 m_gbs
->Add( MLTEXTCTRL("pos(4,3)\nspan(3,1)"),
518 POS(4,3), SPAN(3,1), wxEXPAND
);
519 m_gbs
->Add( TEXTCTRL("pos(5,4)"), POS(5,4), wxDefaultSpan
, wxEXPAND
);
520 m_gbs
->Add( TEXTCTRL("pos(6,5)"), POS(6,5), wxDefaultSpan
, wxEXPAND
);
521 m_gbs
->Add( TEXTCTRL("pos(7,6)"), POS(7,6) );
522 m_gbs
->Add( TEXTCTRL("pos(8,7)"), POS(8,7) );
523 m_gbs
->Add( TEXTCTRL("pos(9,8)"), POS(9,8) );
525 //m_gbs->Add( TEXTCTRL("bad position"), POS(4,3) ); // Test for assert
526 //m_gbs->Add( TEXTCTRL("bad position"), POS(5,3) ); // Test for assert
529 m_moveBtn1
= new wxButton(p
, GBS_MOVE_BTN1
, wxT("Move this to (3,6)"));
530 m_moveBtn2
= new wxButton(p
, GBS_MOVE_BTN2
, wxT("Move this to (3,6)"));
531 m_gbs
->Add( m_moveBtn1
, POS(10,2) );
532 m_gbs
->Add( m_moveBtn2
, POS(10,3) );
534 m_hideBtn
= new wxButton(p
, GBS_HIDE_BTN
, wxT("Hide this item -->"));
535 m_gbs
->Add(m_hideBtn
, POS(12, 3));
537 m_hideTxt
= new wxTextCtrl(p
, -1, wxT("pos(12,4), size(250, -1)"),
538 wxDefaultPosition
, wxSize(250,-1));
539 m_gbs
->Add( m_hideTxt
, POS(12,4) );
541 m_showBtn
= new wxButton(p
, GBS_SHOW_BTN
, wxT("<-- Show it again"));
542 m_gbs
->Add(m_showBtn
, POS(12, 5));
543 m_showBtn
->Disable();
545 m_gbs
->Add(10,10, POS(14,0));
547 m_gbs
->AddGrowableRow(3);
548 m_gbs
->AddGrowableCol(2);
550 p
->SetSizerAndFit(m_gbs
);
551 SetClientSize(p
->GetSize());
555 void MyGridBagSizerFrame::OnHideBtn(wxCommandEvent
&)
557 m_gbs
->Hide(m_hideTxt
);
558 m_hideBtn
->Disable();
563 void MyGridBagSizerFrame::OnShowBtn(wxCommandEvent
&)
565 m_gbs
->Show(m_hideTxt
);
567 m_showBtn
->Disable();
572 void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent
& event
)
574 wxButton
* btn
= (wxButton
*)event
.GetEventObject();
575 wxGBPosition curPos
= m_gbs
->GetItemPosition(btn
);
577 // if it's already at the "other" spot then move it back
578 if (curPos
== wxGBPosition(3,6))
580 m_gbs
->SetItemPosition(btn
, m_lastPos
);
581 btn
->SetLabel(wxT("Move this to (3,6)"));
583 else if ( m_gbs
->SetItemPosition(btn
, wxGBPosition(3,6)) )
586 btn
->SetLabel(wxT("Move it back"));