title: Is it possible to add a custom tooltip on a CMFCToolBarComboBoxButton in a CMFCToolbar?
body: <p>Is it possible to add a custom tooltip on a CMFCToolBarComboBoxButton in a CMFCToolbar ?</p>
  
  <p>I can now use the "default" tooltip text as defined in the resource file, but I cannot find the way to be able to dynamically change the tooltip text on the combobox in the toolbar.</p>
  
  <p>Resources : </p>
  
  <pre><code>IDR_TOOLBAR1 TOOLBAR 16, 15
  BEGIN
    BUTTON      ID_BUTTON32771
    BUTTON      ID_BUTTON32772
    BUTTON      ID_BUTTON32773
  END
  
  STRINGTABLE
  BEGIN
    ID_BUTTON32771 "Button 1\nButton 1"
    ID_BUTTON32772 "Button 2\nButton 2"
    ID_BUTTON32773 "Button 3\nButton 3"
  END
  </code></pre>
  
  <p>Toolbar is created normally and is showing up nicely; I "replace" the button with a CMFCToolBarComboBoxButtoncsCombo in OnToolbarReset (handler of AFX_WM_RESETTOOLBAR )</p>
  
  <pre><code>LRESULT CMainFrame::OnToolbarReset(WPARAM wp,LPARAM)
  {
    UINT uiToolBarId = (UINT) wp;
    if (uiToolBarId == IDR_TOOLBAR1 )
    {
      CMFCToolBarComboBoxButtoncsCombo(ID_BUTTON32772, GetCmdMgr()-&gt;GetCmdImage(ID_BUTTON32772, FALSE), CBS_DROPDOWNLIST);
  
      m_MyToolbar.ReplaceButton(ID_BUTTON32772, csCombo);
      m_MyToolbar.AddItem( _T("un") );
      m_MyToolbar.AddItem( _T("deux") );
      m_MyToolbar.AddItem( _T("trois") );
  
    }
  
    return 0;
  }
  </code></pre>
  
  <p>This work fine, the button is replaced with the combobox and the default tooltip text is displayed.</p>
  
  <p>Now, I want to be able to have the tooltip text changed dynamically.</p>
  
  <p>I tried to handler TTN_NEEDTEXT (and TTN_NEEDTEXTA and TTN_NEEDTEXTW) in the main frame (and even in my derived toolbar class), but it is not called for the toolbars.</p>
  
  <p>I tried deriving my own CMFCToolBarComboBoxButton class and override the 2 virtual methods I could find that should be doing what I expected : </p>
  
  <pre><code>class MyComboBox : public CMFCToolBarComboBoxButton
  {
  public:
    MyComboBox ();
    MyComboBox (UINT uiID, int iImage, DWORD dwStyle = CBS_DROPDOWNLIST, int iWidth = 0);
  
    virtual BOOL OnGetCustomToolTipText(CString&amp; );
    virtual BOOL OnUpdateToolTip(CWnd* , int , CToolTipCtrl&amp; , CString&amp; );
  
    virtual ~MyComboBox ();
    DECLARE_SERIAL(MyComboBox )
  
  };
  </code></pre>
  
  <p>and </p>
  
  <pre><code>IMPLEMENT_SERIAL(MyComboBox , CMFCToolBarComboBoxButton,0)
  
  MyComboBox ::MyComboBox (UINT uiID, int iImage, DWORD dwStyle , int iWidth  ) : CMFCToolBarComboBoxButton(uiID, iImage,dwStyle, iWidth )
  {
  
  }
  
  MyComboBox ::MyComboBox ()
  {
  
  }
  
  MyComboBox ::~MyComboBox ()
  {
  }
  
  BOOL MyComboBox ::OnGetCustomToolTipText(CString&amp; strToolTip) 
  { 
      strToolTip = "bonjour";
      return TRUE;
  }
  
  BOOL MyComboBox ::OnUpdateToolTip(CWnd* /*pWndParent*/, int /*iButtonIndex*/, CToolTipCtrl&amp; /*wndToolTip*/, CString&amp; str) 
  { 
    str = "allo";
    return TRUE; 
  }
  </code></pre>
  
  <p>The 2 virtual methods are never called; well, they are called when opening the application and when closing the application; but never when the application is running normally when the user move/hover the mouse on top of the combobox in the toolbar.</p>
  
  <p>I tried looking into the tooltip manager (CTooltipManager) and enable or not the tooltip manager by calling or not InitTooltipManager.</p>
  
  <p>( I quickly tried this with VS2012 and I get the same "not-working" results).</p>
  
  <p>Are there some steps I am missing to be able to do that ?</p>
  
  <p>Thanks.</p>
  
  <p>Max.</p>