forked from jrsoftware/issrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIStateForm.pas
54 lines (44 loc) · 1.36 KB
/
UIStateForm.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
unit UIStateForm;
{
Inno Setup
Copyright (C) 1997-2024 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.
TUIStateForm, a TForm descendant which correctly handles the hiding of
accelerator key characters and focus rectangles when the
"Hide keyboard navigation indicators" option is enabled.
}
interface
uses
Windows, SysUtils, Messages, Classes, Graphics, Controls, Forms, Dialogs;
type
TUIStateForm = class(TForm)
private
procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY;
procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED;
end;
implementation
const
WM_CHANGEUISTATE = $0127;
UIS_SET = 1;
UIS_CLEAR = 2;
UIS_INITIALIZE = 3;
UISF_HIDEFOCUS = $1;
UISF_HIDEACCEL = $2;
procedure TUIStateForm.CMShowingChanged(var Message: TMessage);
begin
if Showing then
SendMessage(Handle, WM_CHANGEUISTATE, UIS_INITIALIZE, 0);
inherited;
end;
procedure TUIStateForm.CMDialogKey(var Message: TCMDialogKey);
begin
case Message.CharCode of
VK_LEFT..VK_DOWN, VK_TAB:
SendMessage(Handle, WM_CHANGEUISTATE, UIS_CLEAR or (UISF_HIDEFOCUS shl 16), 0);
VK_MENU:
SendMessage(Handle, WM_CHANGEUISTATE, UIS_CLEAR or ((UISF_HIDEFOCUS or UISF_HIDEACCEL) shl 16), 0);
end;
inherited;
end;
end.