Creating A Frame

From WxWiki
Jump to: navigation, search

Normally you create your own class that derives from wxFrame. This way you can add functionality to your own frame class.

#ifndef _TEXTFRAME_H
#define _TEXTFRAME_H

class TextFrame : public wxFrame
   * Constructor. Creates a new TextFrame
   TextFrame(const wxChar *title, int xpos, int ypos, int width, int height);

    * Destructor

#endif //_TEXTFRAME_H

The constructor of wxFrame is called from the TextFrame constructor.

// For compilers that don't support precompilation, include "wx/wx.h";
#include "wx/wxprec.h"

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

TextFrame::TextFrame(const wxChar *title, int xpos, int ypos, int width, int height)
    : wxFrame((wxFrame *) NULL, -1, title, wxPoint(xpos, ypos), wxSize(width, height))


next: The Frame Constructor