개발/프로그래밍(일반)

[MFC] ComboBox with Item Tooltips

kyu76 2010. 2. 2. 03:18

ComboBox with Item Tooltips
Rating:
(출처: http://codeguru.earthweb.com/cpp/controls/combobox/tooltips/article.php/c4949/)

Edward Antonyan (view profile)
April 18, 2001


(continued)

 

 

 

Environment: VC6 SP5, NT4 SP6 ( not tested on other OS )

To use this combo box, follow the following steps:

  1. Include TooltipComboBox.h, TooltipComboBox.cpp, TooltipListCtrl.h and TooltipListCtrl.cpp in your project.
  2. In the resource editor create a droplist combobox.
  3. Create a control member variable for the combobox in VC's classwizard.
  4. Include TooltipComboBox.h and replace CComboBox with CTooltipComboBox in your  .h file. Also include afxtempl.h to support CMap.
  5. To have your own tips, you can either use SetItemTip, SetComboTip functions, or replace GetItemTip function in CTooltipListCtrl, and GetComboTip function in CTooltipComboBox.

Cause this combo box uses CComboBox's listbox to store items, it has no special behavior, and can be used a usual CComboBox. It uses Hai Ha's article style to replace standard drop-down list with a virtual list control. A virtual one to prevent having two identical lists. only droplist combo style is currently working like standard CComboBox.

I think the code is simple enough and doesn't need any other comments.

Downloads

Download source - 6 Kb

 

TooltipComboBox.zip

 

TooltipComboBox.zip
0.01MB