Repository navigation
Expand file tree
/
Copy pathshortcuthelpform.pas
More file actions
executable file
·196 lines (156 loc) · 3.77 KB
/
Copy pathshortcuthelpform.pas
File metadata and controls
executable file
·196 lines (156 loc) · 3.77 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
unit shortcuthelpform;
(*
Show shortcuts as defined in various controls
ad@ardiehl.de 28.10.2023 *)
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, IpHtml,
menus,lclproc,ExtCtrls,StdCtrls,ComCtrls;
type
{ TfrmShortcuts }
TfrmShortcuts = class(TForm)
IpHtmlPanel1: TIpHtmlPanel;
procedure FormCreate(Sender: TObject);
procedure setHelpText(Sender: TObject);
private
public
end;
var
frmShortcuts: TfrmShortcuts;
implementation
uses main;
Resourcestring
csk_connect = 'Connect';
csk_Tabs = 'Tabs';
csk_Data = 'Data';
csk_Steps = 'Steps / Program';
csk_Settings = 'Settings';
csk_Values = 'Values';
csk_Run = 'Run';
csk_Title = 'Shortcut keys';
{$R *.lfm}
{ TfrmShortcuts }
const lineBreak = char(10);
procedure TfrmShortcuts.SetHelpText(Sender: TObject);
var
h: string;
inTab : boolean;
//f : text;
procedure endTab;
begin
if inTab then
begin
inTab := false;
h := h + '</table>'+lineBreak;
end;
end;
procedure beginTab;
begin
if not inTab then
begin
inTab := true;
h := h + '<table>'+lineBreak;
end;
end;
procedure addHead(s: string);
begin
endTab;
h := h + '<h3>'+s+'</h3>'+lineBreak;
end;
procedure addKey(key,func: string);
begin
beginTab;
h := h + '<tr><td>'+key+'</td><td>'+func+'</td></tr>'+lineBreak;
end;
procedure addKeyC2(Caption,Hint: string; shortCut: tShortCut);
var
short,txt,cap : string;
ch : char;
p : integer;
begin
short := '';
txt := Hint;
ch := #0;
if ShortCut > 0 then
short := ShortCutToText(ShortCut);
cap := Caption;
p := pos('&',cap);
if (p > 0) then
begin
ch := cap[p+1];
system.delete(cap,p,1);
end;
if length(txt) < 1 then
txt := cap;
if length(short) < 1 then
if ch <> #0 then
short := 'Alt-'+upcase(ch);
if length(short)>0 then
addKey(short,txt);
end;
procedure addKeyC(c : TComponent);
begin
if c is TTabSheet then
with TTabSheet(c) do
addKey('',Hint)
else if c is TMenuItem then
with TMenuItem(c) do
addKeyC2(Caption,Hint,ShortCut)
else if c is TButton then
with TButton(c) do
addKeyC2(Caption,Hint,0)
else if c is TCustomLabeledEdit then
with TCustomLabeledEdit(c) do
addKeyC2(EditLabel.Caption,EditLabel.Hint,0)
else if c is TControl then
with TControl(c) do
addKeyC2(Caption,Hint,0)
end;
begin
h := '<html><head><title>'+csk_Title+'</title></head><body>'+lineBreak;
inTab := false;
addHead(csk_connect);
AddKeyC(frmMain.mm_Connect);
AddKeyC(frmMain.mm_Disconnect);
addHead(csk_Tabs);
addKeyC(frmMain.tsCharge);
addKeyC(frmMain.tsDischarge);
addKeyC(frmMain.tsProgram);
addKeyC(frmMain.tsConsole);
addHead(csk_Data);
addKeyC(frmMain.mm_savePng);
addKeyC(frmMain.mm_saveCsv);
addKeyC(frmMain.mm_setCsvLogFile);
addKeyC(frmMain.mm_AutoLog);
addHead(csk_Steps);
addKeyC(frmMain.mm_stepLoad);
addKeyC(frmMain.mm_stepEdit);
addKeyC(frmMain.mm_skipStep);
addHead(csk_Settings);
addKeyC(frmMain.mm_Settings);
addKeyC(frmMain.mm_taskBarName);
addKeyC(frmMain.mm_LogFileDir);
addHead(csk_Values);
addKeyC(frmMain.edtCells);
addKeyC(frmMain.edtChargeV);
addKeyC(frmMain.edtCutA);
addKeyC(frmMain.edtCutM);
addKeyC(frmMain.edtCutTime);
addKeyC(frmMain.edtCutEnergy);
addKeyC(frmMain.edtCutCap);
addHead(csk_Run);
addKeyC(frmMain.btnStart);
addKeyC(frmMain.btnStop);
addKeyC(frmMain.btnCont);
addKeyC(frmMain.btnAdjust);
addKeyC(frmMain.tbxMonitor);
endTab;
h := h + '</body>';
IpHtmlPanel1.SetHtmlFromStr(h);
end;
procedure TfrmShortcuts.FormCreate(Sender: TObject);
begin
SetHelpText(Sender);
end;
end.