Nagłówek:
# pragma once
class BasicApplication : public wxApp
{
public:
virtual bool OnInit();
};
class BasicFrame : public wxFrame
{
public:
BasicFrame( const wxChar *title,
int xpos, int ypos,
int width, int height);
~BasicFrame();
wxTextCtrl *theText;
};
cpp
#include <wx/wx.h>
#include "basic.h"
IMPLEMENT_APP(BasicApplication)
bool BasicApplication::OnInit()
{
BasicFrame *frame
= new BasicFrame
("wxWindows Basic Steps - Step 1:"
" A simple application",
200, 200, 800, 600);
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
BasicFrame::BasicFrame
(const wxChar *title,
int xpos, int ypos,
int width, int height)
: wxFrame( (wxFrame *) NULL, -1, title,
wxPoint(xpos, ypos),
wxSize(width, height))
{
theText = (wxTextCtrl *) NULL;
theText
= new wxTextCtrl
( this,
-1,
wxString("Type a command."),
wxPoint(0, 40),
wxSize(200, 10),
wxTE_PROCESS_ENTER
);
}
BasicFrame::~BasicFrame()
{
}
Dlaczego po odpaleniu kontrolka zachowuje się tak jakby miała ustawione wxDefaultPosition, wxDefaultSize?