Skip to content

Commit

Permalink
Fixed crash from move ui item locations.
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflord committed Jan 6, 2024
1 parent bca4723 commit dc8e3ce
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand All @@ -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)
Expand Down Expand Up @@ -699,10 +699,18 @@ ShortcutControl& ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, s
{
shortcutRemapBuffer.back().first[1] = std::get<std::wstring>(newKeys);
const auto& remapControl = keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][1];
const auto& controlChildren = remapControl->GetShortcutControl().Children();
const auto& topLineChildren = controlChildren.GetAt(0).as<StackPanel>();
topLineChildren.Children().GetAt(0).as<ComboBox>().SelectedIndex(1);
controlChildren.GetAt(2).as<TextBox>().Text(std::get<std::wstring>(newKeys));
//const auto& controlChildren = remapControl->GetShortcutControl().Children();
//const auto& topLineChildren = controlChildren.GetAt(0).as<StackPanel>();

/*while (true)
{
Sleep(1000);
}*/

actionTypeCombo.SelectedIndex(1);
unicodeTextKeysInput.Text(std::get<std::wstring>(newKeys));
//topLineChildren.Children().GetAt(0).as<ComboBox>().SelectedIndex(1);
//controlChildren.GetAt(2).as<TextBox>().Text(std::get<std::wstring>(newKeys));
}
}
else
Expand Down

0 comments on commit dc8e3ce

Please sign in to comment.