Prevent one TabbedMDIManager tab from closing
I'm trying to prevent the user from closing the first tab. I don't event want the small close button showing up on that one tab, but the other tabs should be closable and should have the close button. Can't seem to find the right combination.
When my main MDI frame opens, I set the following properties:
TabbedMDIMgr.ShowCloseButton = true;
TabbedMDIMgr.AllowTabGroupCustomizing = false;
I then want an event to raise whenever I mouse over the first tab so I can set TabbedMDIMgr.ShowCloseButton = false; before the user even sees the little close button "x" on that first tab. Is this possible? I've tried handling several events. Here is the method that fires when a tab is added:
private void TabbedMDIManagerTabControlAdded(object sender, TabbedMDITabControlEventArgs args)
{
tabControl = args.TabControl;
args.TabControl.ControlAdded += TabControlControlAdded;
args.TabControl.MouseHover += TabControlMouseHover;
args.TabControl.MouseMove += TabControlMouseMove;
args.TabControl.SizeChanged += TabControlSizeChanged;
args.TabControl.SelectedIndexChanging += TabControlSelectedIndexChanging;
}
The bottom line is that I just want to prevent the close "x" from showing up on a single tab, named "Start". Thanks in advance for your suggestions.
-d
When my main MDI frame opens, I set the following properties:
TabbedMDIMgr.ShowCloseButton = true;
TabbedMDIMgr.AllowTabGroupCustomizing = false;
I then want an event to raise whenever I mouse over the first tab so I can set TabbedMDIMgr.ShowCloseButton = false; before the user even sees the little close button "x" on that first tab. Is this possible? I've tried handling several events. Here is the method that fires when a tab is added:
private void TabbedMDIManagerTabControlAdded(object sender, TabbedMDITabControlEventArgs args)
{
tabControl = args.TabControl;
args.TabControl.ControlAdded += TabControlControlAdded;
args.TabControl.MouseHover += TabControlMouseHover;
args.TabControl.MouseMove += TabControlMouseMove;
args.TabControl.SizeChanged += TabControlSizeChanged;
args.TabControl.SelectedIndexChanging += TabControlSelectedIndexChanging;
}
The bottom line is that I just want to prevent the close "x" from showing up on a single tab, named "Start". Thanks in advance for your suggestions.
-d
SIGN IN To post a reply.
10 Replies
DG
Dan Garvin
August 22, 2009 04:26 AM UTC
A bit more info:
In the MouseHover event, tabControl only changes when I move from off the tabs to a given tab. It does not fire when moving my mouse from one tab across to another. This does appear to be the most promising. Close, but no ...
In the MouseMove event, I can see the mouse pointer coordinates change continuously as I move back and forth across tabs, but not sure how to make use of these coords. to determine which tab I'm on. Besides, as you move the mouse across to a new tab, the close button appears, changing the size of the tab, so mouse pointer coords may not be very helpful.
SelectedIndexChanging event only fires when you are clicking on a tab, not mousing over. Too late to affect the close button.
Thanks again.
In the MouseHover event, tabControl only changes when I move from off the tabs to a given tab. It does not fire when moving my mouse from one tab across to another. This does appear to be the most promising. Close, but no ...
In the MouseMove event, I can see the mouse pointer coordinates change continuously as I move back and forth across tabs, but not sure how to make use of these coords. to determine which tab I'm on. Besides, as you move the mouse across to a new tab, the close button appears, changing the size of the tab, so mouse pointer coords may not be very helpful.
SelectedIndexChanging event only fires when you are clicking on a tab, not mousing over. Too late to affect the close button.
Thanks again.
MJ
Mano J
Syncfusion Team
August 25, 2009 01:28 PM UTC
Hi Dan,
You can do it only by setting ShowCloseButtonForActiveTabOnly property to true as shown below. Note that this will show the close button only for the active tab. If selected index is zero (first tab), hide the close button using ShowCloseButton property.
Regards,
Mano
You can do it only by setting ShowCloseButtonForActiveTabOnly property to true as shown below. Note that this will show the close button only for the active tab. If selected index is zero (first tab), hide the close button using ShowCloseButton property.
public Form1()
{
InitializeComponent();
tabbedMDIManager1.ShowCloseButton = true;
tabbedMDIManager1.ShowCloseButtonForActiveTabOnly = true;
tabbedMDIManager1.TabControlAdded += new TabbedMDITabControlEventHandler(tabbedMDIManager1_TabControlAdded);
}
private TabControlAdv tabcontrol;
private void tabbedMDIManager1_TabControlAdded(object sender, TabbedMDITabControlEventArgs args)
{
tabcontrol = args.TabControl;
tabcontrol.SelectedIndexChanged += new EventHandler(TabControl_SelectedIndexChanged);
}
void TabControl_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabcontrol.SelectedIndex == 0)
tabbedMDIManager1.ShowCloseButton = false;
else
tabbedMDIManager1.ShowCloseButton = true;
}
Regards,
Mano
DG
Dan Garvin
September 10, 2009 03:06 AM UTC
Thanks for the update. Yes, this works when the user CLICKS on the first tab. In fact, when the user clicks on the first tab (tab0) with this code, the "x" doesn't show up on not only the first tab, but it is displayed when I hover over any other tab.
The problem is this: Let's say the user clicks on the second tab. The close "x" is displayed on the second tab. Good. (See picture #1, attached.) If the user then moves the mouse over to the left and only hovers over tab0, the "x" pops up on the first tab. (See picture #2, attached.)
I'm trying to ensure the "x" doesn't even show up if the user hovers over the first tab, yet does show up hovering over any other tab. This is because the user can click on the popped up "x" of an unselected tab.
I've attached two pictures to describe the behavior I'm trying to prevent. Thanks.
tabClose2_5abbac6d.zip
The problem is this: Let's say the user clicks on the second tab. The close "x" is displayed on the second tab. Good. (See picture #1, attached.) If the user then moves the mouse over to the left and only hovers over tab0, the "x" pops up on the first tab. (See picture #2, attached.)
I'm trying to ensure the "x" doesn't even show up if the user hovers over the first tab, yet does show up hovering over any other tab. This is because the user can click on the popped up "x" of an unselected tab.
I've attached two pictures to describe the behavior I'm trying to prevent. Thanks.
tabClose2_5abbac6d.zip
MJ
Mano J
Syncfusion Team
September 10, 2009 06:35 AM UTC
Hi Dan,
Could you please let us know the Syncfusion version you are using, because we don't see this hovering problem in 7.3.0.20?
Regards,
Mano
Could you please let us know the Syncfusion version you are using, because we don't see this hovering problem in 7.3.0.20?
Regards,
Mano
DG
Dan Garvin
September 25, 2009 03:08 PM UTC
Currently on 5.1.1.47. I am planning on upgrading to the latest soon. Thanks.
-Dan
-Dan
DG
Dan Garvin
September 30, 2009 05:21 PM UTC
Are you saying that if I upgrade to 7.x that I won't have this problem? Can you please elaborate and tell me what changed in 7.x to fix this? Thanks.
-dan
-dan
NR
Nandakumar R
Syncfusion Team
September 30, 2009 05:27 PM UTC
Hi,
Thanks for your patience.
Yes, when you upgrade to the latest version, you will not have this issue.
This issue exists in the version 5.1 and this issue seems to be fixed the versions after 5.1. We are backtracking the details on the changes made for this and from which version this issue is fixed. I will get back to you tomorrow on the details of the fix made.
Thanks for your patience.
Regards,
Nanda
Thanks for your patience.
Yes, when you upgrade to the latest version, you will not have this issue.
This issue exists in the version 5.1 and this issue seems to be fixed the versions after 5.1. We are backtracking the details on the changes made for this and from which version this issue is fixed. I will get back to you tomorrow on the details of the fix made.
Thanks for your patience.
Regards,
Nanda
NR
Nandakumar R
Syncfusion Team
October 5, 2009 04:59 AM UTC
Hi,
Thanks for your patience.
This issue has been fixed as part of the version 6.1.0.34. This fix is available with our latest versions and you can upgrade to the latest version here.
Thanks for your patience.
Regards,
Nanda
Thanks for your patience.
This issue has been fixed as part of the version 6.1.0.34. This fix is available with our latest versions and you can upgrade to the latest version here.
Thanks for your patience.
Regards,
Nanda
DG
Dan Garvin
October 10, 2009 06:39 PM UTC
Thanks. I upgraded to 7.3.0.20 and I can see a difference. I still need to test more, but it looks promising. Thanks again for your help.
NR
Nandakumar R
Syncfusion Team
October 12, 2009 04:02 AM UTC
Hi,
Thanks for the update.
Regards,
Nanda
Thanks for the update.
Regards,
Nanda
SIGN IN To post a reply.
- 10 Replies
- 3 Participants
-
DG Dan Garvin
- Aug 22, 2009 04:21 AM UTC
- Oct 12, 2009 04:02 AM UTC