From dc8e3ce1c032af968e05cdf4f05f6bf1ae57317b Mon Sep 17 00:00:00 2001 From: Jeff Lord Date: Fri, 5 Jan 2024 19:37:51 -0500 Subject: [PATCH] Fixed crash from move ui item locations. --- .../ShortcutControl.cpp | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp index 1d8799345e98..59fa6422b3a2 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp @@ -256,8 +256,15 @@ ShortcutControl& ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, s target.Width(EditorConstants::ShortcutTargetColumnWidth); } + uint32_t rowIndex = -1; + if (!parent.Children().IndexOf(row, rowIndex)) + { + return newShortcutToRemap; + } + // add shortcut type choice auto actionTypeCombo = ComboBox(); + actionTypeCombo.Name(L"actionTypeCombo_" + std::to_wstring(rowIndex)); actionTypeCombo.Width(EditorConstants::RemapTableDropDownWidth); actionTypeCombo.Items().Append(winrt::box_value(KeyboardManagerEditorStrings::MappingTypeKeyShortcut())); actionTypeCombo.Items().Append(winrt::box_value(KeyboardManagerEditorStrings::MappingTypeText())); @@ -271,13 +278,6 @@ ShortcutControl& ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, s // add textbox for when it's a text input - uint32_t rowIndex = -1; - - if (!parent.Children().IndexOf(row, rowIndex)) - { - return newShortcutToRemap; - } - auto unicodeTextKeysInput = TextBox(); /*while (true) @@ -699,10 +699,18 @@ ShortcutControl& ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, s { shortcutRemapBuffer.back().first[1] = std::get(newKeys); const auto& remapControl = keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][1]; - const auto& controlChildren = remapControl->GetShortcutControl().Children(); - const auto& topLineChildren = controlChildren.GetAt(0).as(); - topLineChildren.Children().GetAt(0).as().SelectedIndex(1); - controlChildren.GetAt(2).as().Text(std::get(newKeys)); + //const auto& controlChildren = remapControl->GetShortcutControl().Children(); + //const auto& topLineChildren = controlChildren.GetAt(0).as(); + + /*while (true) + { + Sleep(1000); + }*/ + + actionTypeCombo.SelectedIndex(1); + unicodeTextKeysInput.Text(std::get(newKeys)); + //topLineChildren.Children().GetAt(0).as().SelectedIndex(1); + //controlChildren.GetAt(2).as().Text(std::get(newKeys)); } } else