From: Christopher J. Holland.............................................................................. on
Hi,

I have multiple Tabs in the TabCtrl, so the TabCtrl
automatically puts a left and right arrow to bring the page tabs into view.

Well, the ToolTip Rects are not being updated when that happens.
Therefor, I need to update the ToolTip Rects when the left and light arrow
is clicked.

I think I would have to catch some message in PreTranslateMessage and
update the rects there?

I tried catching the WM_LBUTTON down messages and
then GetFocus, but the focus is on the PropertyPage Button,
not on the TabCtrl arrow button.
I don't know how that Could be? I caught the WM_LBUTTON down message
in the Pretranslate in the CApp class. Shouldn't the focus be on the arrow
button?


Thanks,
--
Christopher J. Holland [!MVP]
http://www.mvps.org/vcfaq/
http://www.codeguru.com
http://www.codeproject.com
http://www.naughter.com/
http://support.microsoft.com/default.aspx
http://msdn.microsoft.com/howto/
http://msdn.microsoft.com/library/
www.flounder.com/mvp_tips.htm


From: Christopher J. Holland.............................................................................. on
It took a while, but I figured it out.


First, add a member variable for Arrow Pressed. Call it m_bArrowPress.
Next, add an OnNotify Handler.
The ID of the Arrow Button is 1.
So, when the arrow button is pressed, we set the bool value.
We can't change the ToolTips here, because the tabs haven't been moved yet.
So, we just add a variable to know that the ArrowBtn has been pressed.

BOOL CPropertySheetX::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*
pResult)
{
LPNMHDR lpnmh = (LPNMHDR) lParam;

//Arrow Button on TabCtrl was pressed
if( lpnmh->idFrom == 1){ m_bArrowPress = TRUE; }

return CPropertySheet::OnNotify(wParam, lParam, pResult);
}


Now add an OnWndMsg Handler.
If the Arrow Button is pressed, we update the Tool Tips.
Also, we need to change the tips if the tab control is navigated using the
keyboard arrow keys.


BOOL CPropertySheetX::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam,
LRESULT* pResult)
{
//-------------------------------------------------------------
// If Arrow Button is pressed
//-------------------------------------------------------------
if(m_bArrowPress)
{
m_bArrowPress = FALSE; // Has to come before GetTabCtrl, or infinite loop.
CTabCtrl* tab = GetTabControl();
int id = IDS_FIRST_TOOLTIP;
for (int i = 0; i < tab->GetItemCount(); i++)
{
CRect r;
tab->GetItemRect(i, &r);
m_ToolTipCtrl.SetToolRect(tab, id, r);
id++;
}
}

//-------------------------------------------------------------
// If the arrow keys are used to navigate the Tabs
// 12320 is the CTabCtrl ID.
// It can be found using tab->GetDlgCtrlID()
//-------------------------------------------------------------
if(wParam == 12320)
{
CTabCtrl* tab = GetTabControl();
int id = IDS_FIRST_TOOLTIP;
for (int i = 0; i < tab->GetItemCount(); i++)
{
CRect r;
tab->GetItemRect(i, &r);
m_ToolTipCtrl.SetToolRect(tab, id, r);
id++;
}
}

//-------------------------------------------------------------
// Base Class
//-------------------------------------------------------------
return CPropertySheet::OnWndMsg(message, wParam, lParam, pResult);
}


Thanks anyways,
--
Christopher J. Holland [!MVP]
http://www.mvps.org/vcfaq/
http://www.codeguru.com
http://www.codeproject.com
http://www.naughter.com/
http://support.microsoft.com/default.aspx
http://msdn.microsoft.com/howto/
http://msdn.microsoft.com/library/
www.flounder.com/mvp_tips.htm

"Christopher J.
Holland..........................................................................................................."
<msnews(a)microsoft.com> wrote in message
news:OUlx6CgEFHA.2676(a)TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have multiple Tabs in the TabCtrl, so the TabCtrl
> automatically puts a left and right arrow to bring the page tabs into
> view.
>
> Well, the ToolTip Rects are not being updated when that happens.
> Therefor, I need to update the ToolTip Rects when the left and light arrow
> is clicked.
>
> I think I would have to catch some message in PreTranslateMessage and
> update the rects there?
>
> I tried catching the WM_LBUTTON down messages and
> then GetFocus, but the focus is on the PropertyPage Button,
> not on the TabCtrl arrow button.
> I don't know how that Could be? I caught the WM_LBUTTON down message
> in the Pretranslate in the CApp class. Shouldn't the focus be on the arrow
> button?
>
>
> Thanks,
> --
> Christopher J. Holland [!MVP]
> http://www.mvps.org/vcfaq/
> http://www.codeguru.com
> http://www.codeproject.com
> http://www.naughter.com/
> http://support.microsoft.com/default.aspx
> http://msdn.microsoft.com/howto/
> http://msdn.microsoft.com/library/
> www.flounder.com/mvp_tips.htm
>
>


From: Christopher J. Holland.............................................................................. on
It took a while, but I figured it out.


First, add a member variable for Arrow Pressed. Call it m_bArrowPress.
Next, add an OnNotify Handler.
The ID of the Arrow Button is 1.
So, when the arrow button is pressed, we set the bool value.
We can't change the ToolTips here, because the tabs haven't been moved yet.
So, we just add a variable to know that the ArrowBtn has been pressed.

BOOL CPropertySheetX::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*
pResult)
{
LPNMHDR lpnmh = (LPNMHDR) lParam;

//Arrow Button on TabCtrl was pressed
if( lpnmh->idFrom == 1){ m_bArrowPress = TRUE; }

return CPropertySheet::OnNotify(wParam, lParam, pResult);
}


Now add an OnWndMsg Handler.
If the Arrow Button is pressed, we update the Tool Tips.
Also, we need to change the tips if the tab control is navigated using the
keyboard arrow keys.


BOOL CPropertySheetX::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam,
LRESULT* pResult)
{
//-------------------------------------------------------------
// If Arrow Button is pressed
//-------------------------------------------------------------
if(m_bArrowPress)
{
m_bArrowPress = FALSE; // Has to come before GetTabCtrl, or infinite loop.
CTabCtrl* tab = GetTabControl();
int id = IDS_FIRST_TOOLTIP;
for (int i = 0; i < tab->GetItemCount(); i++)
{
CRect r;
tab->GetItemRect(i, &r);
m_ToolTipCtrl.SetToolRect(tab, id, r);
id++;
}
}

//-------------------------------------------------------------
// If the arrow keys are used to navigate the Tabs
// 12320 is the CTabCtrl ID.
// It can be found using tab->GetDlgCtrlID()
//-------------------------------------------------------------
if(wParam == 12320)
{
CTabCtrl* tab = GetTabControl();
int id = IDS_FIRST_TOOLTIP;
for (int i = 0; i < tab->GetItemCount(); i++)
{
CRect r;
tab->GetItemRect(i, &r);
m_ToolTipCtrl.SetToolRect(tab, id, r);
id++;
}
}

//-------------------------------------------------------------
// Base Class
//-------------------------------------------------------------
return CPropertySheet::OnWndMsg(message, wParam, lParam, pResult);
}


Thanks anyways,
--
Christopher J. Holland [!MVP]
http://www.mvps.org/vcfaq/
http://www.codeguru.com
http://www.codeproject.com
http://www.naughter.com/
http://support.microsoft.com/default.aspx
http://msdn.microsoft.com/howto/
http://msdn.microsoft.com/library/
www.flounder.com/mvp_tips.htm

"Christopher J.
Holland..........................................................................................................."
<msnews(a)microsoft.com> wrote in message
news:OUlx6CgEFHA.2676(a)TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have multiple Tabs in the TabCtrl, so the TabCtrl
> automatically puts a left and right arrow to bring the page tabs into
> view.
>
> Well, the ToolTip Rects are not being updated when that happens.
> Therefor, I need to update the ToolTip Rects when the left and light arrow
> is clicked.
>
> I think I would have to catch some message in PreTranslateMessage and
> update the rects there?
>
> I tried catching the WM_LBUTTON down messages and
> then GetFocus, but the focus is on the PropertyPage Button,
> not on the TabCtrl arrow button.
> I don't know how that Could be? I caught the WM_LBUTTON down message
> in the Pretranslate in the CApp class. Shouldn't the focus be on the arrow
> button?
>
>
> Thanks,
> --
> Christopher J. Holland [!MVP]
> http://www.mvps.org/vcfaq/
> http://www.codeguru.com
> http://www.codeproject.com
> http://www.naughter.com/
> http://support.microsoft.com/default.aspx
> http://msdn.microsoft.com/howto/
> http://msdn.microsoft.com/library/
> www.flounder.com/mvp_tips.htm
>
>