[wxWidget系列] Updating wxWidget from 2.6.X to 2.8.X
2011-04-20 09:10 zhenjing 阅读(479) 评论(0) 编辑 收藏 举报Compile Error and Solution:
1. wxSizer::IsShown -> wxSizer::IsShown must take one argument.
2. Int GetCount() const->unsign Int GetCount() const
3. wxCommandEvent's members is protected, please use related interfaces to access them.
4. wxHIDE_READONLY is not supported by wxFileDialog.
5. The type of (*wxLIGHT_GREY) or (wxWHITE_PEN) is const wxColor or const wxPen.
6. Get/SetTitle() is not support by wxWindow, wxTopLevelWindow supports
7. wxBitmap/wxImage :OK()->IsOk(). Refer to 12.
8. wxRect::Inside->wxRect::Contains
9. wxTreeItemId's wxTreeItemId(long item) and operator long() const
have been deprecated. Please use IsOk() to check if wxTreeItemId is
valid and use default constructor to create invalid wxTreeItemId.
10. The timer functions are deprecated because they work with one
global timer only and wxTimer and/or wxStopWatch classes should be used
instead. The wxTimer class allows you to execute code at specified
intervals. The wxStopWatch class allows you to measure time intervals.
11. wxDialog::OnOK/OnCancel() don't exist any more, use SetAffirmative/EscapeId()
12. Some classes (notably wxBitmap and wxImage) don't define
operator==() as it used to work in somewhat unexpected way as it
compared only internal pointers and not the object data. The code using
it will have to be updated:
* If the object was compared with wxNullXXX, use IsOk() method instead
* If valid object need to be compared, use IsSameAs() to reproduce the old
behaviour or change the code to avoid comparing bitmaps &c.
Run-time Error and Solution:
1. VS 2008 enhance invalid iterator check, such iterator operator+(), ==, !=.
2. VS 2008 checks whether sort function is valid or not while
debugging. If the sort function does exist contradictory points, there
will be an error.
In addition, because of doing validation, it will cost double time than before to do sorting in debug mode of VS.
3. Since wxGrid uses reference number to manage the lifetime of
cell's attributes and renderers, and when the GetCellRenderer() was
called, the reference number of the renderer is increased, So the
DecRef() was called explicitly. Such as call wxGridCellAttr
*wxGrid::GetOrCreateCellAttr(int row, int col) const; Refer to
wxGridCellWorker and wxGridCellRenderer (base class: wxGridCellWorker).
4. wxMenuItem::wxMenuItem(wxMenu* parentMenu = NULL, int id =
wxID_SEPARATOR, const wxString& text = "", const wxString&
helpString = "", wxItemKind kind = wxITEM_NORMAL, wxMenu* subMenu =
NULL)
For the custom (non-stock) menu items, text must be specified and while
helpString may be left empty, it's recommended to pass the item
description (which is automatically shown by the library in the status
bar when the menu item is selected) in this parameter.
5. When using wxBitmapButton of wx289, please don't use
SetBitmapSelect() to set the bitmap of the button, because that bitmap
will only be shown when the button is selected.
6. wx2.8.9 changes the logic of parsing the virtual key from a char, 0 can not be the default key id, please use -1 instead.
7. Please use wxTreeCtrl's EVT_TREE_ITEM_MENU to handle the
requirement of popping context menu, which can handle not only mouse
event and also key event.
8. Don't forget to add the style of "EXPAND" for your control which you want it to be full fill the space.
9. Even if the Windows have been hidden, the Sizer also will reserve
some space for expendable windows. Thus We should change the proportion
flag to control the space allocation.
10. For bool cell of wxgrid, only "" and "1" are accepted as false
and true from version 2.8.9. But in 2.6.2, both "" and "0" are accepted
as false.
11. When wxPlot initializes, it need some font files, if it does not exist, gui will crash without any info.
12. SetSizeHint() is still an API which is needed to pay more
attention, because it may cause some troubles. Maybe you can use
Layout() instead or just eliminate it.
13. If Fit() will use window's best size to display, so if some
window should change size in different situation, please use Fit()
after create the window.
14. If you want to use EVT_TEXT_ENTER(id, func), please add
wxTE_PROCESS_ENTER to window style. In 2.8.9, wxTE_PROCESS_ENTER is
necessary to enable the event wxEVT_COMMAND_TEXT_ENTER.
作者:zhenjing.chen
出处:http://www.cnblogs.com/zhenjing/
未注明转载的文章,版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。