Author Topic: Show variablenames in calltips like in VC++  (Read 5636 times)

Offline He3lixxx

  • Single posting newcomer
  • *
  • Posts: 4
Show variablenames in calltips like in VC++
« on: January 28, 2013, 08:19:49 pm »
Hello,
I'm using Code::Blocks for quite a long time and everything is fine, but there is one thing that's annoying me and I could not find a way to solve it:
the calltips.
Well, they work and show me the argument types and return value type, but it would be much better if they would also show the intern variable names.

Example MessageBoxA():
Code::Blocks Calltip:
WINUSERAPI int WINAPI MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)
Visual C++ Express 2010 Calltip:
int MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)

The VC++ calltip helps me a lot more, because after reading it I know that the first string is the text and the second one is the caption. The Code::Blocks calltip only tells me the type of the variables but I still don't know what they are used for in the function.
Sure, after some time you know that CreateWindow() takes the dimensions in the order left, top, width, height, but it's a bit annoying when you need to look up the function parameters you don't know in the internet (msdn etc...)

This is because the calltips function only scans for the prototype in the header file where only the variable type is noted, but not the name. When I write down the following prototype for my own function, save the document and the look at the calltip, it shows me the full prototype with variable names.

bool test(HWND hWnd, LPCSTR lpCaption);

In the VC++ headers the variable names are written down in the prototypes.
So my question is: How can i make C::B look through the whole winuser.h and take the real function for the calltip, not the prototype? Or are there any alternative headers where the variable names are written down in the prototypes?
Just copying the VC++ headers into my include directory works for the calltips, but compiling a project raises like 200 Errors (of course). Would using another compiler help?

Thanks for any answer.

Edit:
Ok, i've testwise created a new project and chosen the VC++ Compiler. Now the calltips are better, but i don't like the VC++ compiler at all because the errors it gives are very bad in my opinion. Are there any other possibilities to do that? Can i change the include directory the calltip addon / function uses?
« Last Edit: January 28, 2013, 09:48:34 pm by He3lixxx »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Show variablenames in calltips like in VC++
« Reply #1 on: February 22, 2013, 02:11:33 am »
Quote
Example MessageBoxA():
Code::Blocks Calltip:
WINUSERAPI int WINAPI MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)
I don't have such issue, see the screen shot below:

Look, the parameter show both type and its name.
I'm under windows, using mingw compiler suit.
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 He3lixxx

  • Single posting newcomer
  • *
  • Posts: 4
Re: Show variablenames in calltips like in VC++
« Reply #2 on: February 22, 2013, 09:37:43 pm »
First, thank you for your reply.

Did you install the mingw compiler suit on your own, or did you use the C::B installer including mingw? Maybe it's caused by this...
I installed Code::Blocks with the installer including the mingw compiler on my windows machine and then installed the nightly build 8598.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Show variablenames in calltips like in VC++
« Reply #3 on: February 26, 2013, 01:46:47 am »
Did you install the mingw compiler suit on your own, or did you use the C::B installer including mingw?
I install the PCX's mingw compiler(gcc 4.6.3), not the one bundled with the C::B official installer. But I think they should have the same result.
Did you include the correct include file in your source file?
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 He3lixxx

  • Single posting newcomer
  • *
  • Posts: 4
Re: Show variablenames in calltips like in VC++
« Reply #4 on: February 26, 2013, 04:54:10 pm »
Well, that's it, thank you.
PCX's MinGW has other include files than the TDM MinGW files. In their includes, the variable name is also in the prototype and using these includes, the name is also written in the calltip.
Code::Blocks uses TDM MinGW with its include files without the variable names, so they were not shown in the calltip.

As PCX's MinGW still uses gcc 4.6.3 i am now using the TDM MinGW Compiler with the PCX includes and that works fine for me. :D

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Show variablenames in calltips like in VC++
« Reply #5 on: February 26, 2013, 05:57:57 pm »
As PCX's MinGW still uses gcc 4.6.3 i am now using the TDM MinGW Compiler with the PCX includes and that works fine for me. :D

Expect to have weird run time issues with your code; mixing two compiler versions can lead to a product that is very unstable!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline He3lixxx

  • Single posting newcomer
  • *
  • Posts: 4
Re: Show variablenames in calltips like in VC++
« Reply #6 on: February 26, 2013, 08:12:56 pm »
 :(
OK, then, i'll use the PCX MinGW with GCC 4.6.3