From 8a16531e7a95c895dd2cfb92e49fece3a43ee918 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 24 Aug 2009 19:07:19 +0000 Subject: [PATCH] Fix in CtrlLib tutorial, fix in handling accesskeys git-svn-id: svn://ultimatepp.org/upp/trunk@1533 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/LabelBase.cpp | 12 ++++++------ uppsrc/CtrlLib/srcdoc.tpp/Tutorial$en-us.tpp | 8 ++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/uppsrc/CtrlLib/LabelBase.cpp b/uppsrc/CtrlLib/LabelBase.cpp index 55ee6f6ce..3b17d1203 100644 --- a/uppsrc/CtrlLib/LabelBase.cpp +++ b/uppsrc/CtrlLib/LabelBase.cpp @@ -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; diff --git a/uppsrc/CtrlLib/srcdoc.tpp/Tutorial$en-us.tpp b/uppsrc/CtrlLib/srcdoc.tpp/Tutorial$en-us.tpp index 2b8a1e1a8..61e72fdef 100644 --- a/uppsrc/CtrlLib/srcdoc.tpp/Tutorial$en-us.tpp +++ b/uppsrc/CtrlLib/srcdoc.tpp/Tutorial$en-us.tpp @@ -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.&]