How to add access key to button in Inno Setup

强颜欢笑 提交于 2021-02-07 10:29:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!