STR 1745: in fl_ask, if the rightmost button has a shortcut in its label, the default 'Escape' is overridden.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5981 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
ba396b3ea4
commit
d2242d59ef
@ -202,6 +202,11 @@ static int innards(const char* fmt, va_list ap,
|
||||
if (button[1]->visible() && !input->visible())
|
||||
button[1]->take_focus();
|
||||
message_form->hotspot(button[0]);
|
||||
if (b0 && Fl_Widget::label_shortcut(b0))
|
||||
button[0]->shortcut(0);
|
||||
else
|
||||
button[0]->shortcut(FL_Escape);
|
||||
|
||||
message_form->show();
|
||||
int r;
|
||||
for (;;) {
|
||||
|
@ -207,19 +207,28 @@ int fl_old_shortcut(const char* s) {
|
||||
|
||||
// Tests for &x shortcuts in button labels:
|
||||
|
||||
int Fl_Widget::test_shortcut(const char *l) {
|
||||
char c = Fl::event_text()[0];
|
||||
if (!c || !l) return 0;
|
||||
char Fl_Widget::label_shortcut(const char *t) {
|
||||
if (!t) return 0;
|
||||
for (;;) {
|
||||
if (!*l) return 0;
|
||||
if (*l++ == '&' && *l) {
|
||||
if (*l == '&') l++;
|
||||
else if (*l == c) return 1;
|
||||
else return 0;
|
||||
if (*t==0) return 0;
|
||||
if (*t=='&') {
|
||||
char s = t[1];
|
||||
if (s==0) return 0;
|
||||
else if (s=='&') t++;
|
||||
else return s;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
}
|
||||
|
||||
int Fl_Widget::test_shortcut(const char *t) {
|
||||
char c = Fl::event_text()[0];
|
||||
if (!c || !t) return 0;
|
||||
if (c == label_shortcut(t))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Fl_Widget::test_shortcut() {
|
||||
if (!(flags()&SHORTCUT_LABEL)) return 0;
|
||||
return test_shortcut(label());
|
||||
|
Loading…
x
Reference in New Issue
Block a user