How to Learn wxWidgets Programming
2009-07-10 16:33
344 查看
As an overview I would look at the "Alphabetical class reference" section of the reference manual. I find the HTML version to be the easiest to use: you can browse very quickly through it. Here's how to read this (very large) reference:
Get an overview of the kinds of classes involved. The class names will tell you a lot about what each class does. Open some of the classes, in particular, wxApp (the main application object), wxFrame, wxControl (the base class for all controls) and one or two controls, like wxButton.
When scanning a class for the first several times, read the introductory remarks and quickly scan the list of methods of the class to get a general idea about what kinds of operations can be done to objects of the class. You are not looking for detail at this stage, just for the big picture. In particular, what classes exist and how do they work together.
Pay particular attention to the classes from which a class is derived. For example, a button (an object of type wxButton) is derived from the wxControl, wxWindow, wxEvtHandler and wxObject classes. What does this mean? It means that a button _is_ a control, and a button _is_ a window, and a button _is_ an event handler and a button _is_ an object. So you must understand the parent classes of an object to understand the object itself. For example, if b is a button you can invoke b.m for any of method m of the wxControl, wxWindow, wxEvtHandler or wxObject classes. You are not limited to just the methods of wxButton! This is one of the keys of object oriented programming.
Some other tips:
Read some sample code. You will find that almost none of the C++ language is actually being used; it's just endlessly creating objects and then calling methods using those objects.
Learn as much as you can about the String class; after using a good String class you'll never want to use C's string functions again. wxWidgets contains other nifty utilty classes as well.
The application class, wxApp, contains the main event loop. Learn about event handling and event tables (reading sample code will help). Almost everything in this kind of application framework happens as the result of an event and your app is essentially doing nothing but responding to events. Having the event loop written for you is a major, major benefit.
Get an overview of the kinds of classes involved. The class names will tell you a lot about what each class does. Open some of the classes, in particular, wxApp (the main application object), wxFrame, wxControl (the base class for all controls) and one or two controls, like wxButton.
When scanning a class for the first several times, read the introductory remarks and quickly scan the list of methods of the class to get a general idea about what kinds of operations can be done to objects of the class. You are not looking for detail at this stage, just for the big picture. In particular, what classes exist and how do they work together.
Pay particular attention to the classes from which a class is derived. For example, a button (an object of type wxButton) is derived from the wxControl, wxWindow, wxEvtHandler and wxObject classes. What does this mean? It means that a button _is_ a control, and a button _is_ a window, and a button _is_ an event handler and a button _is_ an object. So you must understand the parent classes of an object to understand the object itself. For example, if b is a button you can invoke b.m for any of method m of the wxControl, wxWindow, wxEvtHandler or wxObject classes. You are not limited to just the methods of wxButton! This is one of the keys of object oriented programming.
Some other tips:
Read some sample code. You will find that almost none of the C++ language is actually being used; it's just endlessly creating objects and then calling methods using those objects.
Learn as much as you can about the String class; after using a good String class you'll never want to use C's string functions again. wxWidgets contains other nifty utilty classes as well.
The application class, wxApp, contains the main event loop. Learn about event handling and event tables (reading sample code will help). Almost everything in this kind of application framework happens as the result of an event and your app is essentially doing nothing but responding to events. Having the event loop written for you is a major, major benefit.
相关文章推荐
- How to Learn wxWidgets Programming
- How to Learn Programming Without an Internet?
- How to Learn a Programming Language
- Top 5 Websites To Learn How To Hack Like A Pro
- C++ Programming HOW−TO
- It’s Not Too Late to Learn How to Code
- Linux Serial Programming HOWTO - 串口通讯编程
- ncurses programming howto 书中源代码-4
- about study method - how to learn faster and efficiency
- How To Get a Jump Start In Your Programming Career
- Serial Programming HOWTO
- silverlight: how to programming with video device
- How To Learn English!
- HOW to learn English
- how to learn
- <Learning How to Learn>Week One: Focused versus Diffuse Thinking
- How to Learn Note
- How to learn English
- How to learn English (转载)
- Learning How to Learn