-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Is there a way to get keybinding and convert it to string (text)? #6487
Comments
Maybe you can use this: terminal/src/cascadia/TerminalApp/TerminalPage.cpp Lines 1406 to 1411 in c0ffc9b
|
Even better, I'd try terminal/src/cascadia/TerminalApp/TerminalPage.cpp Lines 106 to 110 in dd684cb
|
Okay thanks! |
So do I replace |
@zadjii-msft. So, can you please give me an example (maybe for the copyText shortcut?) Thanks! |
And what should I call the method? |
I'd probably just make a method on for (const auto& keyAndArgs : _settings->GetKeybindings().GetKeyMap())
{
const auto& chord = keyAndArgs.first;
const auto& actionAndArgs = keyAndArgs.second;
if (keyChord)
{
auto label = KeyChordSerialization::ToString(keyChord);
// Do something with the label here.
// EX: Maybe append it to a text box:
_myTextBox.Text(fmt::format(L"{} - {}", _myTextBox.Text(), label));
}
} That would be easier than building every possible action and then checking if that action is bound to something. |
Thanks! |
@zadjii-msft I figured out the Dialog Construct from run-time part but can you maybe go to my branch on my fork and demonstrate the |
@Chips1234 Sure. This code is a good sample of how to add runs of text to a dialog dynamically at runtime. Then, I'd just do the code I mentioned above to retrieve all the |
Thanks
|
And I put the |
Description of the new feature/enhancement
Is there a way to get the
appkeybinding
item (e.g. shortcut "Ctrl+T") and convert it to string so we can display it as tooltip/dialog label etc? Thank you in advance!The text was updated successfully, but these errors were encountered: