p38
One area where wxWidgets differs from many other frameworks,such as MFC or OWL,is its multi-platform nature.
p43
Development occurs on two main branches:the °sstable°Rbranch,where only binary-compatible bug fixes are allowed,and the °sdevelopment°Rbranch (CVS head).So-called stable releases are even-numbered (for example,2.4.x) and development releases are odd-numbered (for example,2.5.x).
p52
At the very least,your class should define an OnInit function that will be called when wxWidgets is ready to start running your code (equivalent to main or WinMain when writing a C or Win32 application).
If the OnInit function returns true,wxWidgets starts the event loop that processes user input and runs event handlers as necessary.If the function returns false,wxWidgets will clean up its internal structures,and the application will terminate.
wxT(), This macro is also known by the alias _T()“.There is no run-time performance penalty for using it.(You'll also see the underscore macro _() used to enclose strings,which tells wxWidgets to translate the string.See Chapter 16,"sWriting International Applications," for more details.)
p53
IMPLEMENT_APP(MyApp)
Without specifying the class,wxWidgets would not know how to create a new application object.This macro also inserts code that checks that the application and library were compiled using the same build configuration,allowing wxWidgets to report accidental mismatches that might later cause a hard-to-debug run-time failure.
Even if you don't use DECLARE_KPP,you can still use the variable wxTheKpp to call wxKpp functions.
P55
In fact, Close() doesn't directly destroy the frame——it generates a wxEVT_CLOSE_WINDOW event, and the default handler for this event destroys the frame using wxWindow::Destroy.
Note that OnExit() function is only called if OnInit returns true.
p56
XPM files have valid C++ syntax and so can be included as shown previously;
Within each label,a mnemonic letter is marked by a preceding ampersand,and an accelerator is preceded by the tab character (\t).A mnemonic is the letter a user presses to highlight a particular item when the menu is displayed.
p62
The wxWidgets event processing system is a more flexible mechanism than virtual functions,allowing us to avoid declaring all possible event handlers in a base class,which would be totally impractical as well as inefficient.
All event handler functions have the same form——their return type is void they are not virtual, and they take a single event object argument.
p65
The wxWidgets event processing system implements something very close to virtual methods in normal C++,which means that it is possible to alter the behavior of a class by overriding its event handling functions.
void MyTextCtrl::OnChar(wxKeyEvent& event)
{
if ( wxIsalpha( event.keyCode() ) ) {
// Keycode is within range, so do normal processing.
event.Skip() ;
}
else {
// Illegal keystroke. We don't call event.Skip() so the
// event is not processed anywhere else.
wxBell() ;
}
}
p66
You might use DYNAMIC EVENT HANDLERS just because you are using a different language (such as Python) that can't use static event tables.
There are two functions associated with dynamic event tables: wxEvtHandler::Connect and wxEvtHandler::Disconnect.Often,you won't need to call wxEvtHandler::Disconnect because the disconnection will happen when the window object is destroyed.
Notice that this time, when we use dynamic event tables, we do not use the DECLARE_EVENT_TABLE macro.
p67
dynamic event tables example :
frame->Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( MyFrame::OnQuit) );
Window identifiers are integers,and are used to uniquely determine window identity in the event system. In fact,identifiers do not need to be unique across your entire application,just unique within a particular context,such as a frame and its children.
p79
wxButton* button = new wxButton(parent, wxID_OK) ;
上面等同下面:
wxButton* button = new wxButton ;
button ->Create(parent, wxID_OK) ;
p80
A window has a style and an extra style.
The "sextra style" accommodates value that cannot fit into the style value.
p84
Table 4-1 Basic Window Styles
Table 4-2 Basic Extra Window Styles
p85
Table 4-3 wxWindow Events
p94
Table 4-4 wx3rame Styles
p97
If you want to write a more unusual-looking consumer application,such as a clock or media player,you can set a non-rectangular region for the frame, and only that region will be displayed.
p98
a example of SetWindowShape() ;
p105
Table 4-8 wxDialog Styles
p106
Table 4-9 wxDialog Extra Styles
Table 4-10 wxDialog Events
p111
Table 4-11 wxNotebook Styles
p114
There are no special styles for wxScrolledWindow, but usually you will supply wxVSCROLL | wxHSCROLL (the default style for wxScrolledWindow).
No response to “[note]Cross-Platform GUI Programming with wxWidgets ( page 1~121 )” ;
張貼留言