CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2006
    Posts
    27

    tool tip not shown

    Hi,

    In OnInitialUpdate i have set some buttons disabled and some enable.one button when pressed make all buttons enable. i have attached tooltips to all buttons. tooltip shows only at enabled button. its ok . but now tool tip don appear with any button but when i pressed any button which was disabled before, tooltip start appearing on all buttons. i m not understanding why is it so? I want as all buttons get enabled, tooltip should appear.


    P.S. waiting for reply ..........

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: tool tip not shown

    1. How have you implemented tooltips for buttons?

    2.
    Quote Originally Posted by ahmadali
    i have attached tooltips to all buttons. tooltip shows only at enabled button. its ok .
    Does it mean that after you had implemented tooltips they worked as expected?

    3.
    Quote Originally Posted by ahmadali
    ... but now tool tip don appear with any button but when i pressed any button which was disabled before, tooltip start appearing on all buttons....
    Did you change something in already working code before this "now"?
    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2006
    Posts
    27

    Re: tool tip not shown

    the code i implemented is as follows:
    Code:
                   m_AutoTrack.EnableWindow(false);
    		m_Record.EnableWindow(false);		
    		m_BITE.EnableWindow(true);		
    		m_CameraSettings.EnableWindow(false);
    		m_bkl_focus.EnableWindow(false);	
    		m_BrightUp.EnableWindow(false);
    		m_BrightDown.EnableWindow(false);
    		m_MinusZoom.EnableWindow(false);
    		m_PlusZoom.EnableWindow(false);
    		m_Retical.EnableWindow(false);
    		m_Prediction.EnableWindow(false);
    		m_LeadAngle.EnableWindow(false);
    
    	     tooltip=new CToolTipCtrl();
    		tooltip->Create(this);
    		tooltip->Activate(TRUE);
    		tooltip->AddTool(&m_Camera,"Camera ON/OFF");
    		tooltip->AddTool(&m_AutoTrack,"Auto Track");
    		tooltip->AddTool(&m_BITE,"BITE");
    		tooltip->AddTool(&m_Record,"Record");
    		tooltip->AddTool(&m_PlusZoom,"Zoom Increase");
    		tooltip->AddTool(&m_MinusZoom,"Zoom Decrease");
    		tooltip->AddTool(&m_CameraSettings,"Camera Settings");
    		tooltip->AddTool(&m_MODEVIEW,"Manual Mode");
    		tooltip->AddTool(&m_DOWNVIEW,"Down Limit Switch Unpressed");
    		tooltip->AddTool(&m_UPVIEW,"Up Limit Switch Unpressed");
    		tooltip->AddTool(&m_bkl_focus,"BackLight OFF/ON");	
    		tooltip->AddTool(&m_BrightUp,"Brightness Up");	
    		tooltip->AddTool(&m_BrightDown,"Brightness Down");	
    		tooltip->AddTool(&m_GPS,"Test Center");
    Now status of these buttons is disabled except m_BITE.tooptip appears on it but not on any other button. when i pressed m_BITE, all buttons get enabled. after enabling tooltip don appear on any button even on m_BITE. Now when i press any button exept m_BITE tooltip start appearing on all buttons.
    Last edited by Ejaz; March 26th, 2008 at 05:43 AM. Reason: Code tags added

  4. #4
    Join Date
    Jul 2006
    Posts
    27

    Re: tool tip not shown

    im still waiting for guidlines to resolve this problem ...........

  5. #5
    Join Date
    May 2006
    Location
    Norway
    Posts
    1,709

    Re: tool tip not shown

    I suggest that you read this FAQ: Add tooltips to your controls in a dialog

    I have just created a small app and implemented tooltips as shown in that FAQ. I implemented what you explained in post #1 and it worked just as expected.

    Laitinen

  6. #6
    Join Date
    Nov 2005
    Location
    NC, USA
    Posts
    99

    Re: tool tip not shown

    ahmadali,

    One thing that I have noticed in my development is that if there is a window that contains your dialog items, and it is higher up in the tab order, you may not see your Tool Tips.

    For example, if a GroupBox contains buttons, and the GroupBox has a higher tab order (smaller number), then the buttons contained within the GroupBox would not display Tool Tips.

    See if this is what is happening in your situation.

    Dave

  7. #7
    Join Date
    Oct 2011
    Posts
    23

    Smile Re: tool tip not shown

    Try this . . . You should know where to put each piece of this . . .

    Code:
    //in the .h file for the dialog (or whatever)
    
      BOOL OnToolTipNotify(UINT id, NMHDR *pTTTStruct, LRESULT *pResult);
    
      
    
    //in the .cpp file for the dialog (or whatever)
    
      ON_NOTIFY_EX(TTN_NEEDTEXT, 0,      &CDlgSomething::OnToolTipNotify)
    
      
    BOOL CDlgSomething::OnInitDialog()
    {
        CDialog::OnInitDialog();
    
    	. . .
    
        EnableToolTips(TRUE); // add this line to OnInitDialog
    
        return TRUE;
    }
    
    
    
    
    BOOL CDlgSomething::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
    {
      BOOL
        bShowTip = FALSE;
      TOOLTIPTEXT
        *pTTT = (TOOLTIPTEXT*)pNMHDR;
      UINT
        nID = pNMHDR->idFrom;
    
    
        if (pTTT->uFlags & TTF_IDISHWND)
        {
            nID = ::GetDlgCtrlID((HWND)nID);
    
    //        bShowTip = (nID >= IDC_ && nID <= IDC_); // set controls individually
            bShowTip = TRUE;
    
            if(bShowTip)
            {
                pTTT->lpszText = MAKEINTRESOURCE(nID);
                pTTT->hinst    = AfxGetResourceHandle();
                return TRUE;
            }
        }
    
        return FALSE;
    }
    Hope this helps . . . Also, you will need to make a string table entry for each tip (the actual tip itself), and use the resource ID for the control as the string ID to which that particular tip applies. If you only add tip strings for certain controls, you can be selective as to which ones get tips or not.

    Perfect Health and Clarity of Mind,

    --Victor
    Last edited by He_That_Is; January 14th, 2012 at 04:50 AM.

  8. #8
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: tool tip not shown

    Thanks for your enthusiasm He That Is, but keep in mind this thread is basically 4 years old I think it has been solved already...

  9. #9
    Join Date
    Oct 2011
    Posts
    23

    Re: tool tip not shown

    I understand, I search these posts for insights and solutions from the past. And I figured is someone else does this they might appreciate having a couple of solutions in the same place to choose from, that's all . . .

    Be Exceptional,

    --Victor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured