问题
I want to add Alt functions to my audio button; Alt+M for Mute and Alt+P for Play Like this
How? What code should be entered? Where will I insert the code? Here's my script:
SoundCtrlButton := TNewButton.Create(WizardForm);
SoundCtrlButton.Parent := WizardForm;
SoundCtrlButton.Left := 8;
SoundCtrlButton.Top := WizardForm.ClientHeight -
SoundCtrlButton.Height - 8;
SoundCtrlButton.Width := 40;
SoundCtrlButton.Caption :=
ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
SoundCtrlButton.OnClick := @SoundCtrlButtonClick;
回答1:
In Windows controls, you just prefix a letter in control caption with &
to mark is as an access key.
See https://docs.microsoft.com/en-us/cpp/windows/defining-mnemonics-access-keys#mnemonics-access-keys
SoundCtrlButton.Caption := '&Mute';
Or in your case, indirectly via a custom message:
[CustomMessages]
SoundCtrlButtonCaptionSoundOff=&Mute
See how the standard button captions are defined in Default.isl
:
ButtonBack=< &Back
ButtonNext=&Next >
ButtonInstall=&Install
来源:https://stackoverflow.com/questions/40489885/how-to-add-access-key-to-button-in-inno-setup