I was trying to Manually Set Focus border to Tabs selected using SetCurSel()
API. But While doing so i also wanted to set the Keyboard Focus(Dotted Border Focus around the Tab as shown in Picture). All I could achieve is Tab selection using SetCurSel()
.
In my project I don't want the TCN_SELCHANGING
to be send, that's why I'm using SetCurSel()
instead of SetCurFocus()
which will invoke TCN_SELCHANGING
or TCN_SELCHANGE
notification message.
Currently in my code I am overriding LBUTTON
down message to take control of Tab Selection and and I would call SetCurSel()
from there.
LRESULT TabEx::WindowProc( UINT uMsg_i, WPARAM wParam_i, LPARAM lParam_i )
{
switch( uMsg_i )
{
case WM_LBUTTONDOWN :
{
switch( wParam_i )
{
case MK_LBUTTON:
{
int nIndex = GetCurSel( );
if()// Logic To determine Which Tab to Select
{
// Decide to Select nIndex th Tab
SetCurSel( nIndex );
SendSelChangeNotification( TCN_SELCHANGE );
retrun true;
}
break;
}
}
break;
}
.
.
.
.
}
.
.
}
The issue with the above code is it will change the tab selection but No Focus in changed. I cannot use SetCurFocus()
here since I don't want to interfere with TCN_SELCHANGING
. Is there any direct Message call or function call to Set the Focus to a specific Tab?