Print Page | Close Window

Custom tooltip for VirtualMode Report

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=13896
Printed Date: 12 May 2024 at 5:48pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Custom tooltip for VirtualMode Report
Posted By: mdoubson
Subject: Custom tooltip for VirtualMode Report
Date 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");
}
 
 


-------------
Mark Doubson, Ph.D.



Replies:
Posted By: markr
Date 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!



Posted By: mdoubson
Date Posted: 04 September 2009 at 5:30pm
I don't use this function here -
 
https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStatic.rar - https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStatic.rar
 
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
 
 


-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date 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

-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date 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
 
You can get fresh source https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar  and rebuild your app 
 
or get fresh beta-ocx https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar  and use same effect in VB test app


-------------
Mark Doubson, Ph.D.


Posted By: markr
Date 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.


Posted By: mdoubson
Date Posted: 08 September 2009 at 5:26pm
New feature in VirtualMode - multiline items - see updated sample - https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStatic.rar - https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStatic.rar


-------------
Mark Doubson, Ph.D.


Posted By: markr
Date 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?


Posted By: mdoubson
Date 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


-------------
Mark Doubson, Ph.D.



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