CButtonST的tooltip在点击按钮后消失的问题~~~
来源:互联网 发布:软件网页培训学校 编辑:程序博客网 时间:2024/04/29 06:04
真是很难让人相信,在使用CButtonST类多年之后,居然还有这种BUG没有被发现。其实这主要是由于自己很少编写文档试图结构的程序,而这个BUG只出现在文档试图程序中,也就是在对话框程序中完全正常。(从codeproject网站的BBS可以看出,这个BUG同样出现在ActiveX控件中)
自己分析了一会,没有找到原因,惭愧呀。后来从Codeproject网站的BBS找到相应的解决办法,具体如下:
关于这个问题,在codeproject网站的BBS里有如下讨论:
-------------------
a CButtonST button is assigned some tooltip text, and firstly the tooltip show normally, but if I press the button but not release until move the mouse out of the button, that is, i press the MouseLButton in a CButtonST, and release the MouseLButton outside a CButtonST, THEN, the tooltip do not work any more. is it a bug?
此问题无人回复。
Tooltip dissapears?
Great buttons, but have encountered some problems. Added CButtonST buttons to my test project.
I move the mouse cursor over the button and the tooltip shows. Then I press the button and after that if I move the mouse cursor over the button, no tooltip shows. I checked the messages sent to the button in Spy++. Before pressing the button it receives WM_NOTIFY messages, probably from the tooltip control with TTN_SHOW and TTN_POP. However this does not occur after pressing the button. Also I have added the TTS_ALWAYSTIP style for the sake of it but no effect. However, after I create a dialog when selecting a specific menu item in my app the buttons again can show the tooltips. I guess there is some activating/deactivating going on, but even though I add som m_ToolTip.Activate(TRUE) code here and there it will not help. Any ideas, anybody encountered the same problem? Appreciate the help!
I have the same problem – ish
I’m using the class in an OLE control which doesn’t allow PreTranslate message for CButtonST, so instead i’m doing some fudging in OnMouseMove() to cause the tooltip to appear. This works fine in all cases except when the tooltip times out (i.e. mouse on button and timeout occurs and tooltip hides). Once this has happen the button will never show the tip again. I can force it to be shown with CToolTipCtrl::Update() but this isn’t ideal.
这个讨论有个临时解决办法。
最后终于有人给出了一个解决方案,经过实验后,相当好用。
sI also worried about the same problem. Please try the following code.
— CButtonST.h —
protected:
CString m_strTipText;
— CButtonST.cpp —
void CButtonST::SetTooltipText(LPCTSTR lpszText, BOOL bActivate)
{
// We cannot accept NULL pointer
if (lpszText == NULL) return;
////////////////////////////////////////// 添加+++++
m_strTipText = lpszText;
///////////////////////////////////////////
// Initialize ToolTip
InitToolTip();
// If there is no tooltip defined then add it
if (m_ToolTip.GetToolCount() == 0)
{
CRect rectBtn;
GetClientRect(rectBtn);
m_ToolTip.AddTool(this, lpszText, rectBtn, 1);
} // if
// Set text for tooltip
m_ToolTip.UpdateTipText(lpszText, this, 1);
m_ToolTip.Activate(bActivate);
}
LRESULT CButtonST::OnMouseLeave(WPARAM wParam, LPARAM lParam)
{
CancelHover();
///////////////////////////////////////////////////////////添加+++++
if (m_ToolTip.m_hWnd != NULL) {
m_ToolTip.DelTool(this, 1);
if (m_strTipText.IsEmpty() != TRUE) {
CRect rectBtn;
GetClientRect(rectBtn);
m_ToolTip.AddTool(this, m_strTipText, rectBtn, 1);
m_ToolTip.Activate(TRUE);
}
}
////////
return 0;
}
- CButtonST的tooltip在点击按钮后消失的问题~~~
- CButtonST的tooltip在点击按钮后消失的问题
- C#中在按钮上放置ToolTip,点击按钮后tooltip不能显示的解决办法
- 点击后按钮消失
- android alertdialog的按钮点击后不消失
- Android alertdialog的按钮点击后不消失
- AlertDialog点击按钮后对话框不消失的处理方法
- AlertDialog点击按钮后对话框不消失的处理方法
- Android AlertDialog解决点击按钮立即消失的问题
- 让AlertDialog在按钮被点击后不消失
- 让AlertDialog在按钮被点击后不消失
- 让AlertDialog在点击按钮后不消失、不关闭
- 让AlertDialog在按钮被点击后不消失
- 让AlertDialog在点击按钮后不消失、不关闭
- 让AlertDialog在按钮被点击后不消失
- 让AlertDialog在按钮被点击后不消失
- android点击AlertDialog上的按钮后让其不消失
- 点击按钮实现表单的显示,提交数据后表单消失
- GDI(Graphics Device Interface), 图形设备接口
- CDC与HDC的区别
- 简单的线程聊天例子
- (精)HTML中的GET和POST编码
- 不一样的课程表,不一样的Excle--用Excle进行设计(42):排序所演绎的数据逻辑
- CButtonST的tooltip在点击按钮后消失的问题~~~
- Linux SMB共享设置流程
- 完整ASCII字符表
- 理解Bitblt、StretchBlt与SetDIBitsToDevice、StretchDibits
- flash学习之mouseChildren 与 mouseEnabled
- OO对象中up-casting和Down-casting
- OpenMeetings编译详解 (无需OpenLaszlo Server)
- Struts2 下载中文乱码解决 绝对简单低配
- SQL游标语法及举例