COMP 102 - PowerPoint PPT Presentation

About This Presentation
Title:

COMP 102

Description:

Now is the time to think about the paper option for those of ... Button controls for GUIs. SetLabel(wxString) wxString GetLabel() Sets or gets the button text. ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 10
Provided by: webhost
Category:
Tags: comp | guis

less

Transcript and Presenter's Notes

Title: COMP 102


1
COMP 102
  • Topics in support of programming Windowed
    applications on the eagle unix server wxWidgets
    and event driven programming.

2
Admin
  • Exams back
  • Results mixed
  • The Numbers
  • High 114/115
  • Low 79/115
  • Average 92/115
  • Median 86/115
  • Now is the time to think about the paper option
    for those of you struggling.
  • Quick review of exam.

3
Lab4
  • Discussed at end of class
  • Will require you to write your own program from
    scratch
  • for the first time this semester
  • Program must be a window based program that runs
    on Eagle
  • We will again use the wxWindow library for this.

4
Starting a wxWindow program
  • A wxWindow based program needs a class that
    represents the application
  • wxApp is the base class
  • Your main app class must extend/inherit from this
    class
  • Must override the bool OnInit() method
  • bool YourAppOnInit() replaces the main method
    as program entry point
  • Thats right no main!!
  • No c-style methods at all.
  • IMPLEMENT_APP(ltwxApp classgt)

5
wxApp
  • important inherited method
  • SetTopWindow(wxWindow)
  • Takes a pointer to any wxWindow
  • Or object that inherits from wxWindow
  • Makes that window the Apps main window.

6
Putting up a window
  • wxFrame
  • This is the parent class that encapsulates a main
    window
  • one that can live on its own as a movable,
    independent window.
  • Important inherited methods
  • SetSizer(wxSizer)
  • Sizers covered later but are...
  • Remember is-a relationship
  • WxGridSizer is-a wxSizer
  • Constructor
  • Go over in handout.
  • Show(bool)
  • If param true, displays window, if false, hides
    window

7
Sizers
  • Are used to position gui controls on larger
    windows
  • Determine the layout
  • Much like java
  • Unlike VB
  • wxGridSizer good to look at first
  • Constructor
  • Look at in handout.
  • Add(wxWindow) method
  • Add a control to the sizer and place it according
    to where it was added.

8
wxButtons
  • Button controls for GUIs
  • SetLabel(wxString)
  • wxString GetLabel()
  • Sets or gets the button text.
  • You can use a regular string constant for a
    wxString.
  • Can react to events.

9
Event handling.
  • Event handling to respond to button presses and
    other events.
  • In class that will respond to events
  • In class declaration
  • See handout.
Write a Comment
User Comments (0)
About PowerShow.com