Download presentation
Presentation is loading. Please wait.
1
COMP 102 Topics in support of programming Windowed applications on the eagle unix server: wxWidgets and event driven programming.
2
Slide 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
Slide 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
Slide 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 YourApp::OnInit() replaces the main method as program entry point Thats right no main!! No c-style methods at all. IMPLEMENT_APP( )
5
Slide 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
Slide 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
Slide 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
Slide 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
Slide 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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.