GetLabel vs GetLabelText - Mnemonics
-
- Ultimate wxWidgets Guru
- Posts: 670
- Joined: Tue Jul 26, 2016 2:00 pm
GetLabel vs GetLabelText - Mnemonics
These are two functions to get the text of a label in a wxStaticText. For "GetLabel" it says, that it can contain "mnemonics". I don't quite understand what that is and if it is ussually better to use GetLabelText?
Re: GetLabel vs GetLabelText - Mnemonics
Example from the "minimal" sample:
The "&" in "&About" indicates that the next character afterwards (the "A") is a keyboard shortcut. If you press "Alt", that letter will be displayed underlined (at least under Windows). That's called an "mnemonic".
Code: Select all
helpMenu->Append(Minimal_About, "&About\tF1", "Show about dialog");
Use the source, Luke!
-
- Ultimate wxWidgets Guru
- Posts: 670
- Joined: Tue Jul 26, 2016 2:00 pm
Re: GetLabel vs GetLabelText - Mnemonics
Okay, so does that mean that GetLabel() will also copy these & to the string while GetLabelText() won't? So if I have a StaticText saying for examle "Hell&Earth" the GetLabelText() will omit the & and just copy "HellEarth" to a string? If that is the case, I should know which characters are used for mnemonics. Because if I want to use " or ; or other punctuation I risk that they will be omitted. So, actually I could say, I should just use GetLabel() anyways to be sure that all the punctuation gets copied to a string which is what I want.
Oh and by the way: I've also used GetValue() for ComboBoxes. I've just realized that. So what is the different between GetValue() and GetLabel()?
Oh and by the way: I've also used GetValue() for ComboBoxes. I've just realized that. So what is the different between GetValue() and GetLabel()?
Re: GetLabel vs GetLabelText - Mnemonics
The mnemonics are not added automatically, they will only be there if you put them there. So mostly you don't have to care about it.
GetValue is for editable texts, GetLabel for "static" texts (this also includes e.g. the label of a wxButton). Sometimes even the "wrong" one works, but that's not guaranteed.So what is the different between GetValue() and GetLabel()?
Use the source, Luke!
Re: GetLabel vs GetLabelText - Mnemonics
Hi,
To answer another question - I believe the mnemonic indicator is only '&' character, and you can't redefine it. It is system wise.
I may be wrong, though...
Thank you.
To answer another question - I believe the mnemonic indicator is only '&' character, and you can't redefine it. It is system wise.
I may be wrong, though...
Thank you.