Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPToolTipContext very inefficient
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPToolTipContext very inefficient

 Post Reply Post Reply
Author
Message
Graham View Drop Down
Groupie
Groupie


Joined: 12 May 2003
Location: United Kingdom
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote Graham Quote  Post ReplyReply Direct Link To This Post Topic: CXTPToolTipContext very inefficient
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2007 at 10:34am
Hello,
 
Yes, LPSTR_TEXTCALLBACK is supported.
 
lpszText  = LPSTR_TEXTCALLBACK;
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Graham View Drop Down
Groupie
Groupie


Joined: 12 May 2003
Location: United Kingdom
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote Graham Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 12 January 2008 at 11:28pm
I have the same problem here. What to do?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 January 2008 at 11:34am
Hi,
don't use FillInToolInfo but set LPSTR_TEXTCALLBACK.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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 :).
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.