Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » One CExtGridCell, two tooltips Collapse All
Subject Author Date
Krustys Donuts Mar 18, 2009 - 4:44 PM

Dear Support,


I have a CExtGridWnd grid that contains a custom cell that is derived from CExtGridCellEx. This cell displays two CExtBitmap objects. The functionallity I would like to achieve is as follows: When the cursor hovers over one bitmap, tooltip #1 is displayed and when the cursor hovers over the other bitmap, tooltip #2 is displayed. I have overriden OnInitAdvancedTip to provide this funcitonallity.


The problem I have now is as follows: When the cursor hovers over the first bitmap the appropriate tooltip is displayed properly, but when the cursor is moved from the first bitmap to the second bitmap without leaving the cell, the second tooltip is not displayed. Is there any way to reset the hover timer when the cursor is moved off the first bitmap? Or is there a better approach with split cells?


 


Thanks,


Gil

Krustys Donuts Mar 25, 2009 - 9:10 AM

I have implemented your suggestion, but still do not get exactly what I want. The cell contains two bitmaps: left and right. When the cusor is placed over the right bitmap, the expected tooltip is shown. When the cursor is moved from the right bitmap to the left bitmap, the displayed tooltip goes away, but the tooltip for the left bitmap is not displayed as desired. Below is the code:


 



bool

CExtGridWnd & wndGrid,

 

CExtPopupMenuTipWnd & _ATTW,

RECT & rcArea)

{

ASSERT_VALID(

ASSERT_VALID( (&wndGrid) );

ASSERT( ! htInfo.IsHoverEmpty() );

ASSERT( htInfo.IsValidRect() );

CSize szErrBmp = m_bmpAoError.GetSize();

 

VRCellErrWarnAndAo::OnInitAdvancedTip(const CExtGridHitTestInfo & htInfo,this );//Find the X postion of the mouse.

CPoint ptCursor = htInfo.m_ptClient;

CRect rAo = htInfo.m_rcExtra;

rAo.DeflateRect(kAoIndent + szErrBmp.cx, 0,0,0);

CRect rEW = htInfo.m_rcExtra;

rEW.DeflateRect(kAoIndent, 0,0,0);

 

//If the cursor is over the approach orientation icons.

 

 

{

 

{

_ATTW.SetText(m_strAoTooltip.c_str());

rcArea = rAo;

bValidTooltip =

}

}

 

bool bValidTooltip = false;if (rAo.PtInRect(ptCursor))if (!m_strAoTooltip.empty())true;//If the cursor is over the error/warning icon.

 

{

 

else if (rEW.PtInRect(ptCursor))//If there is an error or warning for this approach orientaion.

 

{

_ATTW.SetText(m_strErrorWarningTooltip.c_str());

rcArea = rEW;

bValidTooltip =

}

}

 

}

if (m_nErrType != VRApproOrientation::kNone)true;return bValidTooltip;

 



 

Technical Support Mar 26, 2009 - 6:01 AM

Yes, you are right. There are additional details we forgot to mentioned. First of all, the __EGBS_EX_CELL_TOOLTIPS_INNER style should be applied and the __EGBS_EX_CELL_EXPANDING_INNER style should not present. Second, the hover events should be enabled inside the grid window. Third, you need a grid class like this:

class CMyGridWnd : public CExtNSB < CExtGridWnd >
{
public:
            virtual bool OnGbwHoverRecalc(
                        const POINT * pPtClient = NULL
                        )
            {
                        ASSERT_VALID( this );
                        m_htInfoHover.Empty();
                        return CExtNSB < CExtGridWnd > :: OnGbwHoverRecalc( pPtClient );
            }
};
We created the following sample project for you:

http://www.prof-uis.com/download/forums/OnCellTwoTips.zip

Technical Support Mar 20, 2009 - 1:43 PM

The CExtGridCell::OnInitAdvancedTip() has a RECT & rcArea parameter which describes the entire grid cell location. This rectangle is used by the tooltip window which hides itself automatically when the mouse cursor is moved outside this rectangle. You should change the RECT & rcArea rectangle and make it describing location of one of your cell parts only. The const CExtGridHitTestInfo & htInfo parameter contains the CExtGridHitTestInfo::m_ptClient property describing mouse cursor position.