Simple tutorial: Part 1

This tutorial makes avery simple wxWidgets program, and shows how to insert menus and dialogs. The aim of the project is to make a window which can be coloured

  1. Run wxhatch and choose the compiler you have (Choose | Select external Compiler)
  2. Choose File | New project and select the drawing type. Use the combo box to give the project a name, eg color1. By default the projects will be put in the project directory under wxhatch.
  3. A skeleton code is produced which can be compiled (Run | Make) and then executed (Run|Run)
Add menu Items
  1. Change to the MenuZone window (File | View menu, Ctrl-W) and add the base of a menu (Add menu | New menu). Call it &File; as with other wxWidgets programs the & indicates the hot key
  2. Now add a Menu item, Quit, by using Add Menu | Add Item. If you forget the & then you can right click on the menuzone replica of the menu and choose Change menu properties
  3. Double Click the MenuZone replica of Quit and you should be taken to the method body. Type the response to the menu, in this case Close(); is appropriate
    void MyFrame::OnFileQuit (wxCommandEvent & WXUNUSED(event))
       //Respond to menu here
       Close() ;
  4. Add a second Menu (&Select) containing the command &Color, and a third one (Help) with an item labelled &About
  5. The window should look like this (click for larger view)
screen dump

wxHatch Home link to wxhatch help index