Print Page | Close Window

CXTPToolTipContext very inefficient

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=8645
Printed Date: 13 May 2024 at 10:54pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPToolTipContext very inefficient
Posted By: Graham
Subject: CXTPToolTipContext very inefficient
Date Posted: 02 November 2007 at 4:16am

Is the only way to get the tooltip context to work is by hooking in to the PreTranslateMessage like in the ToolTipContext sample?

This seems very wasteful, as it is building the tooltip text for pretty much every mouse message. I put it in to my application and just by moving the cursor around on the view it uses a lot of CPU (about 40% on 3.2GHz P4D), and no tooltips are even displayed.
 
Is there a way to use these tooltips, by only having to generate the HTML when the tooltip is displayed (like when using LPSTR_TEXTCALLBACK in OnToolHitTest) rather than after every mouse message?
 
Thanks,
Graham



Replies:
Posted By: Oleg
Date Posted: 02 November 2007 at 10:34am
Hello,
 
Yes, LPSTR_TEXTCALLBACK is supported.
 
lpszText  = LPSTR_TEXTCALLBACK;


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Graham
Date Posted: 14 November 2007 at 4:27am
Could you point me in the right direction on how to achieve this please. Using the callback method I handle the notify message TTN_NEEDTEXT. But how do I then display the tooltip context in this function.

CXTPToolTipContext::FillInToolInfo requires a pointer to TOOLINFO which is only available in OnToolHitTest.

Thanks,
Graham


Posted By: znakeeye
Date Posted: 12 January 2008 at 11:28pm
I have the same problem here. What to do?


Posted By: Oleg
Date Posted: 13 January 2008 at 11:34am
Hi,
don't use FillInToolInfo but set LPSTR_TEXTCALLBACK.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 13 January 2008 at 2:12pm

In my report control I do the following in the constructor:

GetToolTipContext()->SetStyle(xtpToolTipHTML);
 
Then I override:
const XTP_NM_REPORTTOOLTIPINFO& CMyReportControl::OnGetToolTipInfo(CXTPReportRow* pRow, CXTPReportRecordItem* pItem, CString& rstrToolTipText)
{
   ...
}
 
What am I doing wrong?


Posted By: mgampi
Date Posted: 14 January 2008 at 4:26am
Hi;
I also hit the same problem.
Oleg, a small sample would be nice!


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: Oleg
Date Posted: 14 January 2008 at 5:31am
Hi,
 
Override INT_PTR CXTPReportControl::OnToolHitTest(CPoint point, TOOLINFO* pTI) const method instead
or don't override any method, call GetToolTipContext()->SetStyle(xtpToolTipHTML);  and set HTML tooltip using pItem->SetTooltip("<b>test</b>");


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 14 January 2008 at 7:41pm
Hmm, I tried setting the tooltip via CMyRecordItem::SetTooltip (once in the constructor). I still get high CPU-peaks.
 
No, this is indeed a bug or "bad" implementation (I know this is hard stuff).
 
Take a look at CHTMLToolTip::GetToolSize:
 
READYSTATE rs;
do
{
    AfxGetApp()->PumpMessage();
    m_pBrowserApp->get_ReadyState (&rs);
}
while (rs != READYSTATE_COMPLETE);
 
And later you call this a lot of times:
m_wndBrowser.MoveWindow(0, 0, cx, nScrollHeight);
 
A solution?
An idea is to instantiate one browser object only (Navigate to "about:" only once!), which you use whenever a tooltip should be displayed. Remember that the Navigate-method takes some 100+ milliseconds on some systems!
 
The size of the html-window is always a problem. I think I have an idea for that too. Simply make it the size of the screen, and then you put all html-code inside a <table width="preferredWidth"> and then you show a window with this browser as a child and set the desired dimensions of the parent window - not the browser itself!
 
Perhaps the resizing of the browser is not the bottleneck here, but if it turns out to be slow you know how to fix it :).


Posted By: Oleg
Date Posted: 18 January 2008 at 6:34am
Hi,
We understand it has delays :( But global webbrowser is not solution.
For 12.0 release we're working with own Markup to replace WebBrowser's rendering.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net