I have an UltraTabControl.
The developer hides tabs based on some application data.
I select the 3rd tab and change data then save. Works fine. I save a reference to the tab
UltraTab
selectedTab = ultraTabControl1.SelectedTab;
I call the method again. Shows all tabs then disables and sets Visible=false to tabs that shouldn't be show.
I select the 3rd tab since it was the tab the user is currently on through code.
ultraTabControl1.ActiveTab = selectedTab;
The 3rd tab is selected, but the Panel that belongs to the 1st tab is on is shown. I can click on any tab except the 1st and it won't change the tab panel.
I click the first tab and the ultratabcontrol beigns to function correctly again, but switch to the correct panel.
I tried to place BeginUpdate and EndUpdate to force a refresh.
Is there a way to re-sync the tabs after they are toggled with enabled/visisble?
Note:
I hooked to the SelectedTabChanged event also and it fires each time
Any ideas are appreciated.
Thanks,
Nick
First of all, you should probably set the SelectedTab property instead of the ActiveTab. That being said, it sounds like a control is incorrectly placed over the UltraTabControl until the 1st tab is selected. When a tab is not selected, we leave its tab page visible, but just move it to a location that cannot be seen. Perhaps the code you are using to hide and show tabs is somehow causing one of the tab pages to stay in view even though it is not selected, either by a bug in the UltraTabControl or your application code. Can you post the code you are using to hide and show the tabs or a sample demonstrating the issue?
/// <summary> /// Disables all the tabs for the six categories of organizations /// </summary> private void DisableAllTabs() { // this is the default tab and it will be visible and enabled. utpProjectDetail.Enabled = true; utpProjectDetail.Visible = true; //utpProjectDetail.Tab.Selected = true;
utpPipeline.Tab.Enabled = false; utpPipeline.Tab.Visible = false;
utpMidstream.Tab.Enabled = false; utpMidstream.Tab.Visible = false;
utpAutomation.Tab.Enabled = false; utpAutomation.Tab.Visible = false;
utpProcessIndustrial.Tab.Enabled = false; utpProcessIndustrial.Tab.Visible = false;
utpUpstream.Tab.Enabled = false; utpUpstream.Tab.Visible = false;
utpDownstream.Tab.Enabled = false; utpDownstream.Tab.Visible = false; }
/// <summary> /// Method enables one tab control based on the organization the /// user selected. Each organization has one associated category that it /// belongs to. Choices include pipeline, upstream, downstream, /// midstream, process and Industrial and Automation. /// </summary> /// <param name="projOrg"></param> private void EnableOrganizationTab(ProjectOrganization projOrg) { UltraTab selectedTab = ultraTabControl1.SelectedTab;
DisableAllTabs(); if (projOrg != null) { switch (projOrg.OrganizationCategory.Name) { case "Pipeline": //utpPipeline.Tab.Selected = true; utpPipeline.Tab.Enabled = true; utpPipeline.Tab.Visible = true; break; case "Upstream": //utpUpstream.Tab.Selected = true; utpUpstream.Tab.Enabled = true; utpUpstream.Tab.Visible = true; break; case "Process Plant Group/Downstream": //utpDownstream.Tab.Selected = true; utpDownstream.Tab.Enabled = true; utpDownstream.Tab.Visible = true; break;
case "Midstream": //utpMidstream.Tab.Selected = true; utpMidstream.Tab.Enabled = true; utpMidstream.Tab.Visible = true; break; case "Process and Industrial": //utpProcessIndustrial.Tab.Selected = true; utpProcessIndustrial.Tab.Enabled = true; utpProcessIndustrial.Tab.Visible = true; break; case "Automation": //utpAutomation.Tab.Selected = true; utpAutomation.Tab.Enabled = true; utpAutomation.Tab.Visible = true; break; default: break; } } else { utpProjectDetail.Show(); utpProjectDetail.Tab.Selected = true; }
ultraTabControl1.ActiveTab = selectedTab; //ultraTabPageControl2.Visible = true; }
utpXXXXX is the tab a previous developer has used.