From: Yoavo on 16 Nov 2006 03:47 Hi, I am using CTooltipCtrl class to set tooltips to my controls in a dialog. The problem is that if a control is disabled, then the tooltip is not shown. note: I tried to use TTS_ALWAYSTIP when I create the CTooltipCtrl, but it didn't help. Yoav.
From: David Webber on 16 Nov 2006 04:33 "Yoavo" <yoav(a)cimatron.co.il> wrote in message news:%234m1PuVCHHA.1012(a)TK2MSFTNGP04.phx.gbl... > I am using CTooltipCtrl class to set tooltips to my controls in a dialog. > The problem is that if a control is disabled, then the tooltip is not > shown. > > note: I tried to use TTS_ALWAYSTIP when I create the CTooltipCtrl, but it > didn't help. I have managed to overcome this *sometimes* by using the AddTool() method to add rectangle of the parent dialogue which coincides with the location of the control. Having both this and the actual control, gives the tool tip both when the control is enabled and when it is disabled. But on some disabled controls it just doesn't seem to work and I haven't yet worked out why. Any guesses on this would be welcome! Dave -- David Webber Author MOZART the music processor for Windows - http://www.mozart.co.uk For discussion/support see http://www.mozart.co.uk/mzusers/mailinglist.htm
From: Dan Bloomquist on 16 Nov 2006 10:36 David Webber wrote: > "Yoavo" <yoav(a)cimatron.co.il> wrote in message > news:%234m1PuVCHHA.1012(a)TK2MSFTNGP04.phx.gbl... > > >>I am using CTooltipCtrl class to set tooltips to my controls in a dialog. >>The problem is that if a control is disabled, then the tooltip is not >>shown. >> > But on some disabled controls it just doesn't seem to work and I haven't yet > worked out why. Any guesses on this would be welcome! Hi, I don't see this in my implementation. But I'm using this method: <http://msdn2.microsoft.com/en-us/library/100e2es9(VS.80).aspx> ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTip ) And OnToolTip is always called even if the window is not enabled. Best, Dan.
From: David Webber on 16 Nov 2006 11:33 "Dan Bloomquist" <public21(a)lakeweb.com> wrote in message news:tA%6h.5534$Ka1.5030(a)news01.roc.ny... > I don't see this in my implementation. But I'm using this method: > <http://msdn2.microsoft.com/en-us/library/100e2es9(VS.80).aspx> > > ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTip ) > And OnToolTip is always called even if the window is not enabled. I use that method for tool tips in my CView-derived window. For controls dialogue boxes I derive a class CTTDialog from CDialog and derive my dialogues from that. CTTDialog has (i.a.) a protected data member CToolTipCtrl m_ToolTip; and a member function CString ToolTipText( int nID ) const; which it uses to get the tool tip text for the control with nID via a virtual mechanism from the derived class. In CTTDialog::OnInitDialog() I essentially do: //==== if( m_ToolTip.Create( this, TTS_ALWAYSTIP ) ) { m_ToolTip.SetMaxTipWidth( SHRT_MAX ); m_ToolTip.SetDelayTime( TTDT_AUTOPOP, SHRT_MAX ); m_ToolTip.SetDelayTime( TTDT_INITIAL, 500 ); m_ToolTip.SetDelayTime( TTDT_RESHOW, 500 ); m_ToolTip.Activate( m_bShowToolTips ); // Now add the controls as tools: CString strToolTip; CWnd *pWndChild = GetWindow(GW_CHILD); while( pWndChild ) { int nID = pWndChild->GetDlgCtrlID(); strToolTip = ToolTipText( nID ); CRect rect; pWndChild->GetWindowRect( &rect ); ScreenToClient( &rect ); // Add a tool which is the actual control AND a pseudo-tool // which is the area it occupies on the actual dialogue. The // latter is important when the control is disabled, and gives // the full functionality for static controls - even ones // with id=IDC_STATIC. if( !strToolTip.IsEmpty() ) { m_ToolTip.AddTool( pWndChild, (LPCTSTR)strToolTip ); m_ToolTip.AddTool( this, (LPCTSTR)strToolTip, &rect, nID ); } pWndChild = pWndChild->GetWindow(GW_HWNDNEXT); } } //=========== As I say it works most of the time. Dave -- David Webber Author MOZART the music processor for Windows - http://www.mozart.co.uk For discussion/support see http://www.mozart.co.uk/mzusers/mailinglist.htm
From: Dan Bloomquist on 16 Nov 2006 12:17 David Webber wrote: > > For controls dialogue boxes > > I derive a class CTTDialog from CDialog and derive my dialogues from that. Hi David, For kicks, I pasted your code into a dialog and just used a "this is a test" for the tip. I get TRUE returned for both AddTool calls for all the controls. For some reason I don't get any tips?! What I've done is add a class to dialogs that I want extended tips in. CTipData tipData; Then it is just a two liner: In init: tipData.Open( _T("RptDirectiveData") ); And: BOOL CReportSectionDirective::OnToolTip( UINT id, NMHDR * pNMHDR, LRESULT * pResult ) { return tipData.DisplayTipText( pNMHDR ); } Best, Dan.
|
Next
|
Last
Pages: 1 2 Prev: CDHTLMDialog troubles Next: Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application |