From 7df8f47ea70792903ae0412d34e1d511f2d16df1 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 10 Nov 2010 16:08:59 +0000 Subject: [PATCH] --- PROMS/Volian.Controls.Library/StepRTB.cs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 5536038b..17ee92be 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -565,7 +565,10 @@ namespace Volian.Controls.Library } } string ostring = SelectedText; - if ((char.IsUpper(ostring, 0) && char.IsUpper(ostring, 1)) || + if (ostring.Length == 0) return; // nothing selected + if (ostring.Length == 1) + type = char.IsUpper(ostring, 0) ? 'l' : 'U'; + else if ((char.IsUpper(ostring, 0) && char.IsUpper(ostring, 1)) || (char.IsLower(ostring, 0) && char.IsUpper(ostring, 1))) type = 'l'; // lower case else if ((char.IsUpper(ostring, 0) && char.IsLower(ostring, 1))) type = 'U'; // upper case else type = 'T'; // Title case @@ -1056,7 +1059,7 @@ namespace Volian.Controls.Library private bool _HandlingCtrlA = false; private void HandleLocalSelectionChange() { - if (MyStepItem.MyStepPanel.SelectedStepRTB != this) + if (MyStepItem != null && MyStepItem.MyStepPanel.SelectedStepRTB != this) return; HandleSelectionChange(); @@ -1692,8 +1695,15 @@ namespace Volian.Controls.Library SendKeys.Send("%H{ESC}"); break; case Keys.Tab: - e.SuppressKeyPress = true; - e.Handled = true; + e.SuppressKeyPress = true; + e.Handled = true; + if (MyStepItem == null) + { + Form frm = ParentForm(this); + if (frm != null) + frm.SelectNextControl(this, true, true, true, true); + } + break; case Keys.Enter: if (!e.Control && !e.Shift && !e.Alt) @@ -1707,6 +1717,12 @@ namespace Volian.Controls.Library break; } } + private static Form ParentForm(Control ctrl) + { + while (!(ctrl.Parent is Form)) ctrl = ctrl.Parent; + return ctrl.Parent as Form; + } + private void StepRTB_HomeEndPressed(KeyEventArgs keyargs) { if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;