public int SetTabOrder( TabScheme scheme )
{
// Tab order isn't important enough to ever cause a crash, so replace any exceptions
// with assertions.
try
{
ArrayList controlArraySorted = new ArrayList();
controlArraySorted.AddRange( container.Controls );
if (!(container is TabControl))
controlArraySorted.Sort( new TabSchemeComparer( scheme ) );
foreach( Control c in controlArraySorted )
{
c.TabIndex = curTabIndex++;
if( c.Controls.Count > 0 )
{
// Control has children -- recurse.
TabScheme childScheme = scheme;
if( schemeOverrides.Contains( c ) )
{
childScheme = (TabScheme) schemeOverrides[c];
}
curTabIndex = (new TabOrderManager( c, curTabIndex, schemeOverrides )).SetTabOrder( childScheme );
}
}
return curTabIndex;
}
catch( Exception e )
{
Debug.Assert( false, "Exception in TabOrderManager.SetTabOrder: " + e.Message );
return 0;
}
}