From 13b3cd6bc4f3dfe6d3761a42c690a753d1d1cce6 Mon Sep 17 00:00:00 2001 From: John Jenko Date: Mon, 18 Nov 2024 14:54:34 -0500 Subject: [PATCH] B2021-094 - Fixed shortcut keystroke usage for the GoTo button when used multiple times --- .../Exe/RefObj/ROEditor/ROEditor.cs | 10 +++++----- PROMS/Volian.Controls.Library/DisplayRO.cs | 8 +++++++- .../Volian.Controls.Library/FormatUtility.cs | 3 ++- .../Volian.Controls.Library/StepTabRibbon.cs | 19 ++++++++++++++++--- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs index c4c782d3..bdfb3d0f 100644 --- a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs +++ b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/ROEditor.cs @@ -504,7 +504,6 @@ namespace ROEditor // if a specific RO was passed in. Load the xml tree from it to the root & then // edit it through the ctlXmledit. // from the input tbl string, get a table name. - ArrayList levelRecids = new ArrayList(); int itbl = System.Convert.ToInt32(specificro.Substring(0,4),16); string stbl = System.Convert.ToString(itbl,10); @@ -594,7 +593,6 @@ namespace ROEditor return; } roTreeView.SelectedNode = trnd; - } protected void roTreeView_AfterSelect (object sender, @@ -676,12 +674,14 @@ namespace ROEditor //if Ctrl/Shift Key is held down if (ROsSelectedforMultiMove == null) ROsSelectedforMultiMove = new List(); - - if ((Control.ModifierKeys & Keys.Shift) != 0) + // B2021-094 added check that Control and Alt keys were not pressed with shift key + // if user does the keystroke (Goto selected RO from step editor) + // but only lifts up on the G key, it was dropping down into this code below + // and getting a null reference error upon initial entry in to the RO Editor + if ((Control.ModifierKeys & Keys.Shift) != 0 && (Control.ModifierKeys & Keys.Control) == 0 && (Control.ModifierKeys & Keys.Alt) == 0) { //if shift is held down, clear existing nodes then add the range of nodes roTreeView_ClearAllMultiSelect(); - if (PreviousNode.Index < CurrentNode.Index) { //Traverse Down diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 6c44d3b3..c420dfa8 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -1078,7 +1078,13 @@ namespace Volian.Controls.Library } else if (searchValue.Contains("#Link:ReferencedObject")) // RO Link (roid) { - searchValue = searchValue.Replace("1[END>", string.Empty).Trim(); + // we where only removing the END if the searchValue ended in "1[END>" + // but sometimes it ended in "2[END>" and cause a null reference error + // - was seen only running via Visual Studio debugger + // I cleaned up the code to remove in ether case so that we get the expected roid value - jsj 11-18-2024 + string substr = searchValue.Substring(searchValue.LastIndexOf(" ")); + if (substr.Contains("[END>")) + searchValue = searchValue.Substring(0, searchValue.Length - substr.Length); string roid = ROFSTLookup.FormatRoidKey(searchValue.Substring(searchValue.LastIndexOf(" ")), true); if (roid != selectedChld.roid) diff --git a/PROMS/Volian.Controls.Library/FormatUtility.cs b/PROMS/Volian.Controls.Library/FormatUtility.cs index d66e4a17..59e34d61 100644 --- a/PROMS/Volian.Controls.Library/FormatUtility.cs +++ b/PROMS/Volian.Controls.Library/FormatUtility.cs @@ -30,7 +30,8 @@ namespace Volian.Controls.Library //We need to check to see if the current database has been updated with the necessary changes //to the folder configuration value. If so then build the list of available to be returned //to the calling code - if (fList == null) + // added check for a list count of zero. Was getting null error from data gotten from customer + if (fList == null || fList.Count == 0) { _MyLog.InfoFormat("Filtered format list not available: Database update needed for config value of top folder record"); return RawList; diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 7e83341b..3bcfd091 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -1376,7 +1376,9 @@ namespace Volian.Controls.Library public static String GetDefaultKeyValue(String key) { object xxx = null; - return Registry.GetValue(key, "", xxx).ToString(); + // fixed null reference error - appeared only while debugged - for user was handled via Try/Catch and ignored + object gtval = Registry.GetValue(key, "", xxx); + return (string)((gtval != null) ? gtval.ToString() : gtval); } private EditItem FindStepAfter(string types, int contenttype) { @@ -3132,7 +3134,13 @@ namespace Volian.Controls.Library // a referenced object, bring up ReferencedObject Editor (for now, just put up a message box. if (_MyStepRTB.MyLinkText != null && _MyStepRTB.MyLinkText.IndexOf("Transition") > -1) { - _MyEditItem.MyStepPanel.OnLinkClicked(sender, new StepPanelLinkEventArgs(_MyStepRTB.MyLinkText)); + // B2021-094 fix for key stroke for GoTo Transition or RO link + // Needed to clear the selection of the link or it will be used the next time + // is used + string lnkText = _MyStepRTB.MyLinkText; // save the transition link information + _MyStepRTB.SetSelection(0, 0); // Clear the selection of the transition link + // note _MyStepRTB.DeselectAll() did not work all the time + _MyEditItem.MyStepPanel.OnLinkClicked(sender, new StepPanelLinkEventArgs(lnkText)); } else { @@ -3155,7 +3163,12 @@ namespace Volian.Controls.Library } else { - LinkText lt = new LinkText(_MyStepRTB.MyLinkText); + LinkText lt = new LinkText(_MyStepRTB.MyLinkText); // save the RO link information + // B2021-094 fix for key stroke for GoTo Transition or RO link + // Needed to clear the selection of the link or it will be used the next time + // is used + _MyStepRTB.SetSelection(0, 0); // clear the selection of the RO link + // note _MyStepRTB.DeselectAll() did not work all the time //B2023-104 If we could not get the MyRoUsageInfo then we have a bad RO Link. Tell user to re-link the RO if (lt.MyRoUsageInfo != null) { -- 2.47.2