Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / problem aligning with sizerS!

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. problem aligning with sizerS!
#2865
Posted by: 2003-11-07 19:16:12
I have problem aligning 2 buttons, 1 on the left side and the other on the right side. Alignment doesn't seem to take effect with the code below.
Basically, I want to lay out the sizers as the following:
------------------------------------------------------------------------
| Left Button |  <------Whatever the size is ------->   | Right Button |
------------------------------------------------------------------------

#include "wx/wxprec.h"

#ifndef WX_PRECOMP 
	#include "wx/wx.h"
#endif

//************************************************************************************
class cFrame: public wxFrame
{
public:
	cFrame(const wxString sTitle, int iWidth, int iHeight)
		:wxFrame((wxFrame *) NULL, -1, sTitle, wxPoint(-1, -1), wxSize(iWidth, iHeight))
	{
		//********************
		// Layout sizer boxes.
		//********************
		wxBoxSizer *pFrameVSizer = new wxBoxSizer(wxVERTICAL);
		
		// Make sure pBodyFrameVSizer occupies the whole frame.
		wxBoxSizer *pBodyFrameVSizer = new wxBoxSizer(wxHORIZONTAL);
		pFrameVSizer->Add(pBodyFrameVSizer, 1, wxEXPAND);
		
		pBodyFrameVSizer->Add(new wxButton(this, -1,  "LEFT", wxPoint(-1, -1)) 	, 0,   wxALIGN_LEFT); 
		pBodyFrameVSizer->Add(new wxButton(this, -1,  "RIGHT", wxPoint(-1, -1))	, 0,   wxALIGN_RIGHT);

		
		SetSizer(pFrameVSizer); 
		SetAutoLayout(TRUE); 
		Layout();
		
	};
};
//************************************************************************************
class cSizerLayout: public wxApp
{
public:
	virtual bool OnInit();
};

DECLARE_APP(cSizerLayout)

IMPLEMENT_APP(cSizerLayout)

bool cSizerLayout::OnInit()
{
	// Create frame and show it.
	cFrame *pFrame = new cFrame("Sizer Testing", 600, 400);
	SetTopWindow(pFrame);
	pFrame->Show(TRUE);
	
	return true;	
}
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,290.00 ·
 
 
¥918.00 ·
 
 
¥890.00 ·
 
 
¥294.00 ·
 
 
¥430.00 ·
 
 
¥1,380.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0