User forums > Help
Code Completion problem with some wx classes
Quiss:
Hi,
Code completion is not working with some classes; wxDataViewCtrl, wxDataViewTreeCtrl, wxDataViewListCtrl and wxDataViewItem are the ones i've checked. The project builds and runs ok by the way. I can see and select, for example m_dataViewCtrl1 but when i enter -> nothing shows up. I tried some other classes like wxDataViewModel and wxPropertyGrid, code completion works fine with them.
I create a new wxWidgets project from the wizard, choose wxWidgets 3.0.x, wxFormBuilder Frame Based, wxWidgets location $(#wx30), all selected in wxWidgets library settings and none selected in Miscellanous settings.
Upon opening WxWizFrame.fbp in wxFormBuilder, it warns about making some changes in code regarding the new version and i need to add #include <wx/msgdlg.h> to header in order to build correctly.
Code::Blocks svn 10091
Windows 8.1
tdm64-gcc-4.7.1-3
wxWidgets-3.0.2 (build configuration: MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug and release)
wxFormBuilder v3.5
ollydbg:
Hi, I did a quick test, and I found that the parser can't parse the file "wxWidgets-3.0.0\include\wx\dataview.h" correctly. It just skip some code in the middle of the parsing. Please report it to our SoureForge page, so that this bug won't lost in our forum. Thank you!
Quiss:
Hi ollydbg,
I've just opened a ticket: https://sourceforge.net/p/codeblocks/tickets/154/
ollydbg:
I just create a very simple test case from the "wxWidgets-3.0.0\include\wx\dataview.h" , which failed in our CCTest.
--- Code: (cpp) ---// bit masks for the various column attributes
enum
{
// column can be resized (included in default flags)
wxCOL_RESIZABLE = 1,
// column can be clicked to toggle the sort order by its contents
wxCOL_SORTABLE = 2,
// column can be dragged to change its order (included in default)
wxCOL_REORDERABLE = 4,
// column is not shown at all
wxCOL_HIDDEN = 8,
// default flags for wxHeaderColumn ctor
wxCOL_DEFAULT_FLAGS = wxCOL_RESIZABLE | wxCOL_REORDERABLE
};
// for compatibility only, do not use
enum wxDataViewColumnFlags
{
wxDATAVIEW_COL_RESIZABLE = wxCOL_RESIZABLE,
wxDATAVIEW_COL_SORTABLE = wxCOL_SORTABLE,
wxDATAVIEW_COL_REORDERABLE = wxCOL_REORDERABLE,
wxDATAVIEW_COL_HIDDEN = wxCOL_HIDDEN
};
class AAA
{
int m_aaa;
};
AAA b;
//b.//m_aaa
--- End code ---
Note: I believe our parser failed on the line "wxDATAVIEW_COL_HIDDEN = wxCOL_HIDDEN".
Edit: Changes to C++ code style.
ollydbg:
I debugged a while, and I found that the bug is introduced in r9642.
The reason is that:
--- Code: (cpp) ---enum wxDataViewColumnFlags
{
wxDATAVIEW_COL_RESIZABLE = wxCOL_RESIZABLE,
wxDATAVIEW_COL_SORTABLE = wxCOL_SORTABLE,
wxDATAVIEW_COL_REORDERABLE = wxCOL_REORDERABLE,
wxDATAVIEW_COL_HIDDEN = wxCOL_HIDDEN
};
--- End code ---
Note that wxCOL_HIDDEN is not a member token of the wxDataViewColumnFlags, so the below code goes to the else clause.
--- Code: (cpp) ---bool ParserThread::CalcEnumExpression(Token* tokenParent, long& result, wxString& peek)
{
// need to force the tokenizer skip raw expression
const TokenizerState oldState = m_Tokenizer.GetState();
// expand macros, but don't read a single parentheses
m_Tokenizer.SetState(tsRawExpression);
Expression exp;
wxString token, next;
while (IS_ALIVE)
{
token = m_Tokenizer.GetToken();
if (token.IsEmpty())
return false;
if (token == _T("\\"))
continue;
if (token == ParserConsts::comma || token == ParserConsts::clbrace)
{
m_Tokenizer.UngetToken();
peek = token;
break;
}
if (token == ParserConsts::dcolon)
{
peek = SkipToOneOfChars(ParserConsts::commaclbrace);
exp.Clear();
break;
}
if (wxIsalpha(token[0]) || token[0] == ParserConsts::underscore_chr) // handle enum or macro
{
const Token* tk = m_TokenTree->at(m_TokenTree->TokenExists(token, tokenParent->m_Index, tkEnumerator));
if (tk) // the enumerator token
{
if (!tk->m_Args.IsEmpty() && wxIsdigit(tk->m_Args[0]))
token = tk->m_Args; // add the value to exp
}
else
{
peek = SkipToOneOfChars(ParserConsts::commaclbrace);
exp.Clear();
break;
}
}
--- End code ---
I just debugged into the function SkipToOneOfChars(ParserConsts::commaclbrace), I see that the "}" is already eat in this function. When up to the caller "void ParserThread::HandleEnum()", we will eat another token after "}", and finally the code after that will be eat, and the body of class AAA is totally skipped.
Navigation
[0] Message Index
[#] Next page
Go to full version