Author Topic: Code Completion Question [Solved]  (Read 5186 times)

Offline IanConner

  • Single posting newcomer
  • *
  • Posts: 2
Code Completion Question [Solved]
« on: November 12, 2015, 07:39:32 pm »
I was trying out Code:Bocks by playing around with the default wxWidgets frame based application generated by Code:Blocks, when I noticed some functions weren't auto completing.

To give an example from the default application, a main window class is declared that inherits from wxFrame:

Code
class wxWidgetsTestFrame: public wxFrame

In the OnInit() function it creates an instance of this class called fame:

Code
bool wxWidgetsTestApp::OnInit()
{
    wxWidgetsTestFrame* frame = new wxWidgetsTestFrame(0L, _("wxWidgets Application Template"));
    frame->SetIcon(wxICON(aaaa)); // To Set App Icon
    frame->Show();
   
    return true;
}

The wxWidgets documentation shows that wxFrame inherits indirectly from wxWindow, so I would expect that any calls made on the frame object to wxWindow functions would auto complete.  However, if I try to call a wxWindow function on frame in the above function it doesn't complete.  For example if I start typing frame->SetSize, SetSize doesn't show in the function list and the parameter list doesn't appear when I type the opening parenthesis.  Code completion is working for all wxFrame functions, but not for the functions it inherits from higher up in the class hierarchy.

Should code completion be working when calling a wxWindow function from a wxFrame object or does Code::Blocks not support code completion for inherited functions?

If it should be working, do you have any idea why it's not working on my installation?  I'm using Code::Blocks 13.12 and wxWidgets 3.0.2 on Windows 7 64bit.

Thanks for any advice you can offer.
« Last Edit: November 13, 2015, 02:50:53 pm by IanConner »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Code Completion Question
« Reply #1 on: November 13, 2015, 12:57:39 am »
Works fine here, you should use a nightly build version of C::B. The official 13.12 version is quite old.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline IanConner

  • Single posting newcomer
  • *
  • Posts: 2
Re: Code Completion Question [Solved]
« Reply #2 on: November 13, 2015, 03:05:10 pm »
I downloaded the 09 November 2015 build (10561) and code completion works perfectly in that.

When I downloaded Code::Blocks I just went for the latest stable version as I assumed nightly builds were for testing, and I didn't notice how old the last stable release was.

Thanks for the assistance.