This section allows you to quickly find features that need to be converted.
Include files
IPC classes
MDI style frames
OnActivate
OnChar
OnClose
OnEvent
OnMenuCommand
OnPaint
OnSize
wxApp definition
wxButton
wxCanvas
wxDialogBox
wxDialog::Show
wxForm
wxPoint
wxRectangle
wxScrollBar
wxText, wxMultiText, wxTextWindow
wxToolBar
Use the form:
#include <wx/wx.h> #include <wx/button.h>For precompiled header support, use this form:
// For compilers that support precompilation, includes "wx.h". #include <wx/wxprec.h> #ifdef __BORLANDC__ #pragma hdrstop #endif // Any files you want to include if not precompiling by including // the whole of <wx/wx.h> #ifndef WX_PRECOMP #include <stdio.h> #include <wx/setup.h> #include <wx/bitmap.h> #include <wx/brush.h> #endif // Any files you want to include regardless of precompiled headers #include <wx/toolbar.h>
These are now separated out into wxDDEServer/Client/Connection (Windows only) and wxTCPServer/Client/Connection (Windows and Unix). Take care to use wxString for your overridden function arguments, instead of char*, as per the documentation.
MDI is now implemented as a family of separate classes, so you can't switch to MDI just by using a different frame style. Please see the documentation for the MDI frame classes, and the MDI sample may be helpful too.
Replace the arguments with one wxActivateEvent& argument, make sure the function isn't virtual, and add an EVT_ACTIVATE event table entry.
This is now a non-virtual function, with the same wxKeyEvent& argument as before. Add an EVT_CHAR macro to the event table for your window, and the implementation of your function will need very few changes.
The old virtual function OnClose is now obsolete. Add an OnCloseWindow event handler using an EVT_CLOSE event table entry. For details about window destruction, see the Windows Deletion Overview in the manual. This is a subtle topic so please read it very carefully. Basically, OnCloseWindow is now responsible for destroying a window with Destroy(), but the default implementation (for example for wxDialog) may not destroy the window, so to be sure, always provide this event handler so it is obvious what's going on.
This is now a non-virtual function, with the same wxMouseEvent& argument as before. However you may wish to rename it OnMouseEvent. Add an EVT_MOUSE_EVENTS macro to the event table for your window, and the implementation of your function will need very few changes. However, if you wish to intercept different events using different functions, you can specify specific events in your event table, such as EVT_LEFT_DOWN.
Your OnEvent function is likely to have references to GetDC(), so make sure you create a wxClientDC instead. See Device contexts.
If you are using a wxScrolledWindow (formerly wxCanvas), you should call PrepareDC(dc) to set the correct translation for the current scroll position.
You need to replace this virtual function with a series of non-virtual functions, one for each case of your old switch statement. Each function takes a wxCommandEvent& argument. Create an event table for your frame containing EVT_MENU macros, and insert DECLARE_EVENT_TABLE() in your frame class, as per the samples.
This is now a non-virtual function, with a wxPaintEvent& argument. Add an EVT_PAINT macro to the event table for your window.
Your function must create a wxPaintDC object, instead of using GetDC to obtain the device context.
If you are using a wxScrolledWindow (formerly wxCanvas), you should call PrepareDC(dc) to set the correct translation for the current scroll position.
Replace the arguments with one wxSizeEvent& argument, make it non-virtual, and add to your event table using EVT_SIZE.
The definition of OnInit has changed. Return a bool value, not a wxFrame.
Also, do not declare a global application object. Instead, use the macros DECLARE_APP and IMPLEMENT_APP as per the samples. Remove any occurrences of IMPLEMENT_WXWIN_MAIN: this is subsumed in IMPLEMENT_APP.
For bitmap buttons, use wxBitmapButton.
Change the name to wxScrolledWindow.
Change the name to wxDialog, and for modal dialogs, use ShowModal instead of Show.
If you used Show to show a modal dialog or to override the standard modal dialog Show, use ShowModal instead.
See also
Sorry, this class is no longer available. Try using the wxPropertyListView or wxPropertyFormView class instead, or use .wxr files and validators.
The old wxPoint is called wxRealPoint, and wxPoint now uses integers.
This is now called wxRect.
The function names have changed for this class: please refer to the documentation for wxScrollBar. Instead of setting properties individually, you will call SetScrollbar with several parameters.
Change all these to wxTextCtrl. Add the window style wxTE_MULTILINE if you wish to have a multi-line text control.
This name is an alias for the most popular form of toolbar for your platform. There is now a family of toolbar classes, with for example wxToolBar95, wxToolBarMSW and wxToolBarSimple classes existing under Windows 95.
Toolbar management is supported by frames, so calling wxFrame::CreateToolBar and adding tools is usually enough, and the SDI or MDI frame will manage the positioning for you. The client area of the frame is the space left over when the menu bar, toolbar and status bar have been taken into account.