I am having an issue with my layout using sizers, the problem occurs when i add the options
wxBORDER_NONE or wxBORDER_SIMPLE to my wxFrame, i have been trying all week to fix this with no luck.
i have tried to fix by using different sizer layouts, horizontal, vertical and options such as wxALIGN_RIGHT etc
in many different combinations, all to no effect.
as soon as the BORDER options are added to my frame, my sizers and controls lose all position and get pushed to the left.
I am not sure if this is my inexperience or an unintended feature lol
i will post the code below, i got this code from zetcode, but the same problem exists in my own code as well
hopefully one of you will see what i am doing wrong, or the problem
thanks
Sizers.h
Code: Select all
#include <wx/wx.h>
class Sizers : public wxFrame
{
public:
Sizers(const wxString& title);
};
Code: Select all
#include "Sizer.h"
Sizers::Sizers(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxPoint(wxDefaultPosition), wxSize(wxDefaultSize))<wxBORDER_NONE/SIMPLE>
{
wxPanel *panel = new wxPanel(this, wxID_ANY);
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);
wxButton *ok = new wxButton(panel, wxID_ANY, wxT("Ok"));
wxButton *cancel = new wxButton(panel, wxID_ANY, wxT("Cancel"));
hbox1->Add(new wxPanel(panel, wxID_ANY));
vbox->Add(hbox1, 1, wxEXPAND);
hbox2->Add(ok);
hbox2->Add(cancel);
vbox->Add(hbox2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 0);
panel->SetSizer(vbox);
Centre();
}
Code: Select all
#include <wx/wx.h>
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
Code: Select all
#include "main.h"
#include "Sizer.h"
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
Sizers *sizers = new Sizers(wxT("Align"));
sizers->Show(true);
return true;
}