Author Topic: Tooltips for Win32API and oter functions  (Read 6978 times)

Offline Vuki

  • Multiple posting newcomer
  • *
  • Posts: 41
Tooltips for Win32API and oter functions
« on: November 17, 2005, 10:18:57 am »
I've downloaded and installed Code::Blocks and I think it's awesome. However, the feature that I miss is displaying a tooltip with function prototype (parameters list) in a tooltip, like Visual Studio does. Searching for IDEs I've found MinGW Developer Studio. It's very barebone, but it has this feature, implemented as 'calltip'. See here for screenshot: http://www.parinyasoft.com/mds_win_snapshot7.html. It's implemented using a 'win32.ctp' file which contains function prototypes. I assume that both C::B and MinGW DS use Scintilla as the editor component. Is there a possibility to implement this feature in C::B? That would be great and it would stop me from thinking about switching to VS Express.

Offline kkez

  • Almost regular
  • **
  • Posts: 153
    • WinapiZone
Re: Tooltips for Win32API and oter functions
« Reply #1 on: November 17, 2005, 03:25:38 pm »
It's already available under the name of "Code completion" (it's a plugin). Just go to Settings -> plugins' settings -> Code completion  :)

Offline Vuki

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Tooltips for Win32API and oter functions
« Reply #2 on: November 17, 2005, 04:22:30 pm »
Kkez, I know about Code completion plugin but it's not what I meant. See screenshot linked in my post. Code completion plugin is not very useful. For example, write CreateWindow and press Ctr+Space. You'll get something like this:
Code
CreateWindowExW(DWORD,LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID) : WINAPI
Now try to figure which parameter is which.
In my opinion, MinGW Developer Studio uses better approach. Besides, hovering the mouse cursor over function displays tooltip with function description).

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: Tooltips for Win32API and oter functions
« Reply #3 on: November 17, 2005, 04:36:10 pm »
There are two approachs to code completion:
1) Using a ctags like file which contains all the api functions (which is generated from the code).
2) Parsing the sourcecode in place.

Code::Blocks uses the 2nd approach, which I found better because if the (api or yours) code changes it'll reflected rapidly.

However it needs to improve the C/C++ parser (or use another), so that it extracts comments/documentation and puts in the tooltip (just as you described).

But however, the 1st approach will need to be implemented too, because sometimes there are sourcecode which not includes comments/documentation in the code, but they provide something like a ctags file (some examples can be w32api or PHPapi I think).

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Tooltips for Win32API and oter functions
« Reply #4 on: November 17, 2005, 04:43:46 pm »
Go on, switch to  MinGW developer studio. You will be back soon :)
I know because I have used it myself before switching to Code::Blocks.

But seriously, this approach is of course possible, do note, however, that while it has advantages, it has disadvantages too - it is a lot less flexible. The code completion plugin in Code::Blocks is quite universal, it works on (almost) any kind of source without any additional "calltip files".

What do you think about writing a plugin that reads its prototypes from a calltip file? Code completion is only just a plugin too, so you could just replace it with something that is statically prototyped.
Without having looked into it deeper, I believe that you could write such a plugin in not too much time, an afternoon or two maybe -- most of it is there already.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Tooltips for Win32API and oter functions
« Reply #5 on: November 17, 2005, 08:20:14 pm »
C'mon guys, don't scare the newbie :( Remember the customer is always right! (Except when he's wrong of course :P ). We don't want to become like those elitist linux zealots who yell at the users, do we? :shock: OK OK I know your comments were a joke, but it could be misinterpreted.

Besides, Vuki's suggestion is a valid one, altho it's up to the developer of the code completion plugin to analyse the proposal.

Offline Vuki

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Tooltips for Win32API and oter functions
« Reply #6 on: November 17, 2005, 08:33:48 pm »
Go on, switch to  MinGW developer studio. You will be back soon :)

Well, I won't switch to MinGW DS. But I may switch to VC++ 2005 Express and not return here  :wink:
Anyway, I think that existing Code Completion + optional Tootlips would be great and helpful. Not every programmer has the whole Win32API in their memory.

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: Tooltips for Win32API and oter functions
« Reply #7 on: November 17, 2005, 08:55:04 pm »
Fill a Feature Request.
A code completion Ctags based wouldn't be difficult to implement.

About Ctags:
http://ctags.sourceforge.net/

    * Supports 33 programming languages
    * It is capable of generating tags for all types of C/C++ language tags
    * Compiles on UNIX, MSDOS, Windows 95/98/NT, OS/2, QNX, Amiga, QDOS, VMS, Macintosh, and Cray.
    * Included in major Linux distributions
    * Tag index files are supported by most major editors, including: vi, Emacs, JED, jEdit, UltraEdit
    * Fast: Even for an unsorted 24MB tag file, tag searches take about one second on a 650 MHz Athlon Linux machine.

Offline lukeH

  • Single posting newcomer
  • *
  • Posts: 7
Re: Tooltips for Win32API and oter functions
« Reply #8 on: November 21, 2005, 07:30:51 am »
I'm currently in progress on a ctags plugin.  However there's something I'd like to know - can two autocomplete plugins work together?
I'd like to see the current C::B autocomplete first try to handle completion, then if it fails use the ctags one.  This would allow one to have the benefit of C::B's good plugin, but also to type the windows's constants and suchlike without having to add windows.h into the project and have a huge, slow autocomplete cache.

What do you think?
- Luke


OOPS, I suppose this is a development question. Sorry