Page 1 of 1

TabStrip doesn't raise events

Posted: 20 Feb 2009, 00:00
by TickTick
I don't know if it's a bug. I think not, but it's pretty annoying...
In your sample the TabStrip control raises events like Click, MouseDown, etc. But when I add a second tabstrip to it (or to a completely new project), I do not get any events for the control that I have added, and I just can't figure out what I'm doing wrong.
Hans

Re: TabStrip doesn't raise events

Posted: 20 Feb 2009, 10:47
by TiKu
Have a look at the property DisabledEvents (also configurable at design time via the property pages). Most events are disabled by default to increase performance.

Re: TabStrip doesn't raise events

Posted: 20 Feb 2009, 12:51
by TickTick
Thanks!
I didn't know that it wouldn't show up in the properties (I don't mean the property sheet) and that it could only be accessed by property sheet or by code.
I don't know about others, but to me a TabStrip without click events is useless (I need an event in which I can set .ZOrder for my pictureboxes), that's why I am wondering why you chose to not set having events as a default).
I believe you had your reasons, but it's not comfortable.
Hans.

Re: TabStrip doesn't raise events

Posted: 20 Feb 2009, 13:26
by TiKu
The Click event isn't what you're looking for. It is raised if the user clicks anywhere on the control. It is NOT raised if the user activates another tab (which also can be done by code or by keyboard).
You should use the ActiveTabChanged event, which never is disabled.

Re: TabStrip doesn't raise events

Posted: 20 Feb 2009, 13:52
by TickTick
Hello!
I made a few mistakes... I have to admit it!!
I see that by default all events are enabled (looking at the property sheet), so please accept my apologies...
Out of interest... how would I trigger a Click event? I click everywhere on the TabStrip, but nothing happens. Not that I need this event (thanks so much for your explanation on the ActiveTabChanged), but I wonder how it can ever be raised.
Hans

Re: TabStrip doesn't raise events

Posted: 20 Feb 2009, 14:46
by TiKu
TickTick wrote:I see that by default all events are enabled (looking at the property sheet)
No, that's not right. The property is called DisabledEvents. So any event in the list that is checked, is disabled and not enabled.
TickTick wrote:Out of interest... how would I trigger a Click event? I click everywhere on the TabStrip, but nothing happens. Not that I need this event (thanks so much for your explanation on the ActiveTabChanged), but I wonder how it can ever be raised.
Remove the check mark next to "Click events". Then it will work.