I am working though the wxWidgets bitmap video and neither text nor the circle appear. I am using visual studio 2008 and wxWidgets2.8.10 On Windows 7 pro. An empty gray window launches. Here's the code
Code:
//MainFrame.h
#ifndef MAIN_FRAME_H
#define MAIN_FRAME_H
#include "wx/wx.h"
enum ID_LIST
{
PAINT_WINDOW = 400
};
class MainFrame : public wxFrame
{
public:
MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size);
void OnPaint( wxPaintEvent &event);
void OnMotion( wxMouseEvent &event);
private:
wxWindow *paintWindow;
};
#endif
//MainFrame.cpp
#include "MainFrame.h"
MainFrame::MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size) : wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
paintWindow = new wxWindow(this, PAINT_WINDOW);
paintWindow->Connect(PAINT_WINDOW, -1, wxEVT_PAINT, (wxObjectEventFunction) &MainFrame::OnPaint, NULL, this);
paintWindow->Connect(PAINT_WINDOW, -1, wxEVT_MOTION, (wxObjectEventFunction) &MainFrame::OnMotion, NULL, this);
}
void MainFrame::OnPaint( wxPaintEvent &event)
{
wxPaintDC dc(paintWindow);
dc.DrawText(_T("SomeText"),200, 200);
}
void MainFrame::OnMotion( wxMouseEvent &event)
{
wxPoint mousePos = event.GetPosition();
wxClientDC dest(paintWindow);
dest.SetPen(*wxWHITE_PEN);
dest.DrawCircle(mousePos,5);
}