[mapguide-commits] r4908 - sandbox/maestro-2.5/Maestro.Base
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue May 18 05:27:49 EDT 2010
Author: jng
Date: 2010-05-18 05:27:49 -0400 (Tue, 18 May 2010)
New Revision: 4908
Modified:
sandbox/maestro-2.5/Maestro.Base/TabFactory.cs
Log:
The original Mono workaround for tab closure caused problems in windows (ugh). So I've put that workaround around a platform check and if it's windows, we close the way it was meant to be done.
Modified: sandbox/maestro-2.5/Maestro.Base/TabFactory.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/TabFactory.cs 2010-05-18 09:16:51 UTC (rev 4907)
+++ sandbox/maestro-2.5/Maestro.Base/TabFactory.cs 2010-05-18 09:27:49 UTC (rev 4908)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
+using OSGeo.MapGuide.MaestroAPI;
namespace Maestro.Base
{
@@ -81,33 +82,42 @@
var tabs = page.Parent as TabControl;
if (tabs != null && tabs.TabPages.Contains(page))
{
- int idx = -1;
-
- //HACK: Mono (2.4) will chuck a hissy fit if we remove
- //a tab from a TabControl that has a selected tab so we
- //have to null the selected tab, but this cause weird
- //visual effects once the tab is removed, so we record
- //the selected index, so we can assign the one beside it
- //to be the selected tab after removal.
- if (tabs.SelectedTab == page)
+ if (Platform.IsWindows)
{
- idx = tabs.SelectedIndex;
- tabs.SelectedTab = null;
+ var idx = tabs.TabPages.IndexOf(page);
+ tabs.TabPages.Remove(page);
+ if (idx > 0)
+ tabs.SelectedIndex = --idx;
}
- tabs.TabPages.Remove(page);
-
- if (idx > 0)
+ else
{
- idx--;
- tabs.SelectedIndex = idx;
- }
- else
- {
- //Set to first tab if available.
- if (tabs.TabCount > 0)
+ int idx = -1;
+ //HACK: Mono (2.4) will chuck a hissy fit if we remove
+ //a tab from a TabControl that has a selected tab so we
+ //have to null the selected tab, but this cause weird
+ //visual effects once the tab is removed, so we record
+ //the selected index, so we can assign the one beside it
+ //to be the selected tab after removal.
+ if (tabs.SelectedTab == page)
{
- tabs.SelectedIndex = 0;
+ idx = tabs.SelectedIndex;
+ tabs.SelectedTab = null;
}
+ tabs.TabPages.Remove(page);
+
+ if (idx > 0)
+ {
+ idx--;
+ tabs.SelectedIndex = idx;
+ }
+ else
+ {
+ //Set to first tab if available.
+ if (tabs.TabCount > 0)
+ {
+ tabs.SelectedIndex = 0;
+ }
+ }
}
}
};
More information about the mapguide-commits
mailing list