Connecting Tech Pros Worldwide Help | Site Map

Problem with tab control event

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 7th, 2007, 11:55 PM
Mark F.
Guest
 
Posts: n/a
Default Problem with tab control event

I have two tab controls (four tabpages each) and each tab control is in a
splitter panel (horiz orientation). I added a event handlers to handle the
selected tab event. The upper tab control works when every tab is selected.
The lower tab control only seems to work when the first three tabs are
selected, not the last.

Any ideas why?

Thanks,
Mark



  #2  
Old March 9th, 2007, 08:25 PM
Jay Riggs
Guest
 
Posts: n/a
Default Re: Problem with tab control event

On Mar 7, 4:43 pm, "Mark F." <reply2gr...@nospam.comwrote:
Quote:
I have two tab controls (four tabpages each) and each tab control is in a
splitter panel (horiz orientation). I added a event handlers to handle the
selected tab event. The upper tab control works when every tab is selected.
The lower tab control only seems to work when the first three tabs are
selected, not the last.
>
Any ideas why?
>
Thanks,
Mark

Mark,

I created a VS.NET 2003 WinForm project, added a panel and to the
panel a tab, a splitter (oriented as horizontally) and another tab.

I wired both tab controls to its SelectedIndexChanged event and on
clicking each TabPage in both tabs the event fired.

I then wired the TabIndexChanged event for both tabs and found that
this event didn't fire for any TabPage for either tab. I'm not sure
why, perhaps I don't understand what the event is supposed to do
exactly.

For fun (or at least what passes for fun for me these days) I had both
tabs SelectedIndex property display when the SelectedIndexChanged
events fired. I noticed that the SelectIndex was changing, yet
changing the index via a mouse click wasn't firing the TabIndexChanged
event.

I was going to post my project but saw that it would have been pretty
much illegible. If you're not using the SelectedIndexChanged event
for your tab controls, perhaps that's you're solution.

-Jay

  #3  
Old March 10th, 2007, 02:45 PM
Mark F.
Guest
 
Posts: n/a
Default Re: Problem with tab control event

"Jay Riggs" <jay.s.riggs@gmail.comwrote in message
news:1173474598.612690.206010@p10g2000cwp.googlegr oups.com...
Quote:
I created a VS.NET 2003 WinForm project, added a panel and to the
panel a tab, a splitter (oriented as horizontally) and another tab.
>
I wired both tab controls to its SelectedIndexChanged event and on
clicking each TabPage in both tabs the event fired.
>
I then wired the TabIndexChanged event for both tabs and found that
this event didn't fire for any TabPage for either tab. I'm not sure
why, perhaps I don't understand what the event is supposed to do
exactly.
>
For fun (or at least what passes for fun for me these days) I had both
tabs SelectedIndex property display when the SelectedIndexChanged
events fired. I noticed that the SelectIndex was changing, yet
changing the index via a mouse click wasn't firing the TabIndexChanged
event.
>
I was going to post my project but saw that it would have been pretty
much illegible. If you're not using the SelectedIndexChanged event
for your tab controls, perhaps that's you're solution.
>
-Jay
>
Thanks Jay,

I simply wanted to display the current view (tabpage) on a statusbar pane.
private void viewsTabControl_SelectedIndexChanged(object sender, EventArgs
e)
{
sbrViewPane.Text = viewsTabControl.SelectedTab.Text;

// or ...,

// sbrViewPane.Text =
viewsTabControl.TabPages[viewsTabControl.SelectedIndex].Text;
}

I think that I found the trouble. One view is a picturebox control that
previews an image file if the user selects one. I used the OnPaint event to
draw text in the view if the user clicks the tab and no image is loaded (ie,
"No image selected"). When I commented out the Paint code block the
SelectedIndexChanged event fires normally for the preview tabpage. I still
don't know why this behavior is occurring however.

Mark






 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.