Tabcontrol sets focus to last tab after deletion

  • Thread starter Thread starter Josh Usovsky
  • Start date Start date
J

Josh Usovsky

I am dynamically adding and deleting tabs in a tabcontrol
at runtime. When I remove (RemoveAt()) a tabpage, focus
is automatically set to the final tabpage. I want focus
to remain on the tab that had focus before the event
occurred. How can I force the tabcontrol to not change
focus or at least make it appear that way? Setting the
focus immediately after the tabpage removal produces an
unseemly flash. Any suggestions?

Josh Usovsky
 
* "Josh Usovsky said:
I am dynamically adding and deleting tabs in a tabcontrol
at runtime. When I remove (RemoveAt()) a tabpage, focus
is automatically set to the final tabpage. I want focus
to remain on the tab that had focus before the event
occurred. How can I force the tabcontrol to not change
focus or at least make it appear that way? Setting the
focus immediately after the tabpage removal produces an
unseemly flash. Any suggestions?

This code shows how to detect when the selected tab changes:

<http://www.google.de/[email protected]>

Maybe you can use it.
 
Not quite what I was looking for, but thank you, just the
same. It seems like there should be a simpler way of
preventing this behavior without having to resort to
Win32 overrides and messy things like that. I don't
understand why this is the default behavior in the first
place.

--JU
 
* said:
Not quite what I was looking for, but thank you, just the
same. It seems like there should be a simpler way of
preventing this behavior without having to resort to
Win32 overrides and messy things like that. I don't
understand why this is the default behavior in the first
place.

IMO that's a bug.
 
Back
Top