Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Custom tooltip for VirtualMode Report
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Custom tooltip for VirtualMode Report

 Post Reply Post Reply
Author
Message
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Topic: Custom tooltip for VirtualMode Report
    Posted: 01 April 2009 at 10:59pm

You can use this:
 
afx_msg void OnReportNeedTooltip(NMHDR * pNotifyStruct, LRESULT * result);

ON_NOTIFY(XTP_NM_REPORT_GETTOOLTIPINFO, XTP_ID_REPORT_CONTROL, OnReportNeedTooltip)

void CVirtualListView::OnReportNeedTooltip(NMHDR* pNotifyStruct, LRESULT * /*result*/)
{
XTP_NM_REPORTTOOLTIPINFO* pItemNotify = (XTP_NM_REPORTTOOLTIPINFO*) pNotifyStruct;

if (!pItemNotify->pRow || !pItemNotify->pItem)
return;

TRACE(_T("\nRow=%d Index=%d\n"),
pItemNotify->pRow->GetIndex(),    //this is row #
pItemNotify->pItem->GetIndex());  //this is column #
 
//e.g. if (pItemNotify->pItem->GetIndex() == 4) pItemNotify->pItem->SetTooltip("AAA");
}
 
 
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 04 September 2009 at 5:22pm
Mark, there appears to be something wrong with this functionality.

I'm running XTP v13.1.0 (latest public release at time of this writing), and there appears that the tooltips are not painted correctly when moving from one report record to another.

To make sure my app was not at fault somehow, I modified CodeJock sample entitled "VirtualList". I added the ON_NOTIFY macro for message XTP_NM_REPORT_GETTOOLTIPINFO, along with the following method:

void CVirtualListView::OnReportNeedTooltip(NMHDR* pNotifyStruct, LRESULT * /*result*/)
{
    XTP_NM_REPORTTOOLTIPINFO* pItemNotify = (XTP_NM_REPORTTOOLTIPINFO*) pNotifyStruct;

    if (!pItemNotify->pRow || !pItemNotify->pItem)
        return;

    CString sFormat;
    sFormat.Format(_T("%d, %d"),
        pItemNotify->pRow->GetIndex(),    //this is row #
        pItemNotify->pItem->GetIndex());  //this is column #

    pItemNotify->pItem->SetTooltip(sFormat);
}

Now compile and run the sample, moving your mouse over various rows and columns. You'll quickly see that the tooltip is not showing the correct row and item index values. What's interesting here is that the values ARE being assigned correctly - the tooltip just doesn't show them correctly for some period of time.

In other words, using TRACE shows the *correct* values in the debug output window, but the tooltip still does not paint the correct text!

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 September 2009 at 5:30pm
I don't use this function here -
 
 
and I can see tolltip for any cells if cell width is not enough
 
Now I updated it and you can see Custom Tooltip for column 5 items for any width of this column
 
 
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 September 2009 at 5:34pm
It works with Notification respond but in same logical conditions - small column width - I can see for one given column my text "AAA"

void CVirtualListView::OnReportNeedTooltip(NMHDR* pNotifyStruct, LRESULT * /*result*/) {

XTP_NM_REPORTTOOLTIPINFO* pItemNotify = (XTP_NM_REPORTTOOLTIPINFO*) pNotifyStruct;

if (!pItemNotify->pRow || !pItemNotify->pItem)

return;

if (pItemNotify->pItem->GetIndex() == 4)

pItemNotify->pItem->SetTooltip("AAA");

TRACE(_T("\nRow=%d Index=%d\n"), pItemNotify->pRow->GetIndex(), pItemNotify->pItem->GetIndex());

}

So we need to force show tooltip if app pass it without checking cell width for external (notification-based) text passed?

Btw - in Calendar control I have special flag to force show tooltip
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 September 2009 at 5:53pm

Confirmed - It work for any cases after I add flag 

CXTPReportPaintManager::m_bForceShowTooltip (default = FALSE)
 
same for OCX as PaintManager.ForceShowTooltip = True
 
Thanks for catch
 
 
or get fresh beta-ocx https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar and use same effect in VB test app
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2009 at 8:38am
> Thanks for catch
 
And thank you for getting the problem resolved so quickly.

You folks provide the best support in the business.
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2009 at 5:26pm
New feature in VirtualMode - multiline items - see updated sample - https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStatic.rar
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2009 at 4:45pm
Mark, this still doesn't appear to be working as expected in the v13.2 beta.

I'm setting

GetReportControl().GetPaintManager()->m_bForceShowTooltip = TRUE;

... but the tooltip still exhibits the problem behavior I described in my previous post.

Maybe your changes haven't yet made it into the v13.2 beta?
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2009 at 5:00pm
No, they did. There is a problem with tooltip cache - sometimes it show old tooltip string if you move mouse too fast. Need to move mouse in the point where there is no tooltip and move back to proper item - now it will works.
I also have same problem in some NON VIRTUAL MODE project where statusbar always show proper text but tooltip show old value:

((CFrameWnd*) AfxGetMainWnd())->SetMessageText(s); --- WORKS ALWAYS

SetTooltip(s); --- NOT ALWAYS!

so this tooltip problem is not related to virtual mode!

Btw - m_bForceShowTooltip flag have another purpose - show tooltip in the case item text is fit in the item rectangle and usual criteria to show tooltip prevent it.

But I checked again my virtual mode case:

void CVirtualListView::OnReportNeedTooltip(NMHDR* pNotifyStruct, LRESULT * /*result*/) {

XTP_NM_REPORTTOOLTIPINFO* pItemNotify = (XTP_NM_REPORTTOOLTIPINFO*) pNotifyStruct;

if (!pItemNotify->pRow || !pItemNotify->pItem) return;

CString s; s.Format(_T("Custom Tooltip text %d"), rand() % 100);

if (GetReportCtrl().IsIconView()) {

if (pItemNotify->pItem->GetIndex() == GetReportCtrl().m_iIconViewColumn)

pItemNotify->pItem->SetTooltip(s); }

else {

if (pItemNotify->pItem->GetIndex() == 4)

pItemNotify->pItem->SetTooltip(s); }

}

and it works well - no missing or wrong tooltip strings
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.203 seconds.