I’ve been line by line through zetcode tutorial titled “A Simple button” using the IDE C::B Code::Blocks.
http://zetcode.com/tutorials/wxwidgetstutorial/firstprograms/
This tutorial produces some output that looks like this:
The source looks like this:
#include “button.h”
Button::Button(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(270, 150))
{
wxPanel *panel = new wxPanel(this, wxID_ANY);wxButton *button = new wxButton(panel, wxID_EXIT, wxT(“Quit”),
wxPoint(20, 20));
Connect(wxID_EXIT, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(Button::OnQuit));
button->SetFocus();
Centre();
}void Button::OnQuit(wxCommandEvent & WXUNUSED(event))
{
Close(true);
}
Hopefully this should be a quick post. I’m looking at
wxPanel *panel = new wxPanel(this, wxID_ANY);
For a vb6 programmer this panel stuff is looking weird. In vb6 you basic create the form and basically drop where ever you want. I’ve run into this panel type stuff in Gtk+ Gtkmm. To me it’s just plane weird..
Anyway looking through: http://docs.wxwidgets.org/stable/wx_wxpanel.html#wxpanel
The stated purpose appear to be:
A panel is a window on which controls are placed. It is usually placed within a frame. It contains minimal extra functionality over and above its parent class wxWindow; its main purpose is to be similar in appearance and functionality to a dialog, but with the flexibility of having any window as a parent.
Hm.. I guess I’m going need to explore dialog boxes at some point… One thing that looks different to me is that what’s in the constructor and the code appears to be different.
Code:
wxPanel *panel = new wxPanel(this, wxID_ANY);
Constructor:
wxPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = “panel”)
This is a bit confusing to me at the moment why the parameter count been the code and the constructor doesn’t match up. This is something need to research this a bit further to round out my C++ knowlege. In my mind a couple of things could be happening here, and I don’t to state something incorrect here… [ Need to Add some more stuff here]
Derived from
wxWindow
wxEvtHandler
wxObject
It seems like most of the parameters seem familiar enough to me since I reviewed them with wxWindow, so for the moment, I’m just going to keep going.