Create a new class called mainwindow which should inherit


Problem

Objective

Use the Game of Life template create an empty window utilizing wxWidgets.

Instructions

A. Create a new class called MainWindow which should inherit from the wxFrame class

B. Include "wx/wx.h" in the MainWindow header file. If Visual Studio tries to import something else in an attempt to make wxFrame work, just delete it.

C. Add a public constructor and destructor to MainWindow

D. Create an empty destructor for now.

E. In the constructor, some arguments need to be passed to the wxFrame base class

F. This will look something like this:

a. MainWindow::MainWindow : wxFrame(args...)

b. The arguments that wxFrame is expecting are the following wxFrame (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)

c. Since this is the first window, there is no parent, so parent should be nullptr

d. The ID doesn't matter, so use wxID_ANY

e. For title, use any string that describes the application. "Game of Life" probably makes the most sense.

f. Where the window should appear on the screen and how big it should be needs to be set. The point variable is a set of coordinates based on 0,0 being the upper left hand corner of the screen. To use that, enter wxPoint(0,0). The size is similarly a set of pixels. To make a window that is a 200 pixel square, you would use wxSize(200,200).

G. Now that a window has been created, the app object need to load it on start.

a. Start by creating a MainWindow pointer in App.h

b. There are two items to do in the App::OnInit() method in App.cs.

c. Instantiate the MainWindow pointer

d. Call the Show() method on the pointer.

H. If the project is run at this point, the app should open a window.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Create a new class called mainwindow which should inherit
Reference No:- TGS03354360

Expected delivery within 24 Hours