Fix in CtrlLib tutorial, fix in handling accesskeys

git-svn-id: svn://ultimatepp.org/upp/trunk@1533 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-08-24 19:07:19 +00:00
parent ae025e191f
commit 8a16531e7a
2 changed files with 12 additions and 8 deletions

View file

@ -97,18 +97,18 @@ int ExtractAccessKey(const char *s, String& label)
int ChooseAccessKey(const char *text, dword used)
{
for(const char *s = text; *s; s++) {
byte ac = ToAscii(*s);
if(ac >= 'A' && ac <= 'Z' && (Ctrl::AccessKeyBit(ac) & used) == 0)
byte ac = *s;
if(ac < 128 && ac >= 'A' && ac <= 'Z' && (Ctrl::AccessKeyBit(ac) & used) == 0)
return MAKELONG(ac, s - text + 1);
}
for(const char *s = text; *s; s++) {
byte ac = ToUpper(ToAscii(*s));
if(ac >= 'A' && ac <= 'Z' && ac != 'I' && ac != 'L' && (Ctrl::AccessKeyBit(ac) & used) == 0)
byte ac = ToUpper(*s);
if(ac < 128 && ac >= 'A' && ac <= 'Z' && ac != 'I' && ac != 'L' && (Ctrl::AccessKeyBit(ac) & used) == 0)
return ac;
}
for(const char *s = text; *s; s++) {
byte ac = ToUpper(ToAscii(*s));
if(ac >= 'A' && ac <= 'Z' && (Ctrl::AccessKeyBit(ac) & used) == 0)
byte ac = ToUpper(*s);
if(ac < 128 && ac >= 'A' && ac <= 'Z' && (Ctrl::AccessKeyBit(ac) & used) == 0)
return ac;
}
return 0;

View file

@ -4288,8 +4288,8 @@ that invoke [* Accept] and [* Reject] as needed before calling the
[s7; -|-|Add(cancel.SetLabel(`"Cancel`").LeftPosZ(100, 64).TopPosZ(40,
24));&]
[s7; &]
[s7; -|-|ok <<`= [* Acceptor]([*@(128.0.255) IDOK]);&]
[s7; -|-|cancel <<`= [* Rejector]([*@(128.0.255) IDCANCEL]);&]
[s7; -|-|ok.[* Ok]() <<`= [* Acceptor]([*@(128.0.255) IDOK]);&]
[s7; -|-|cancel.[* Cancel]() <<`= [* Rejector]([*@(128.0.255) IDCANCEL]);&]
[s7; -|`}&]
[s7; `};&]
[s7; &]
@ -4305,6 +4305,10 @@ that invoke [* Accept] and [* Reject] as needed before calling the
[s7; -|`}&]
[s7; `}&]
[s7; &]
[s0; &]
[s0; Calls to [* Ok] and [* Cancel] methods of Button here make Button
react to Enter and Esc keys.&]
[s0; &]
[s0; To reduce tedious tasks even further, there are CtrlLayoutOK,
CtrlLayoutCancel, CtrlLayoutOKCancel etc. template functions
that both setup layout and assign Acceptors and Rejectors.&]