Hi,
Just noticed that the messagebox below is not cancelled by Esc. Shouldn't it? =============== MessageBox confirm: 'Sure?' =============== -- Regards Hwee Boon MotionObj |
Hi,
> Just noticed that the messagebox below is not cancelled by Esc. > Shouldn't it? > > =============== > MessageBox confirm: 'Sure?' > =============== No, I don't think so. The ESC key is normally bound to a Cancel button whereas the above MessageBox is displayed with Yes and No buttons. You'll find that the keyboard shortcuts for these are 'Y' and 'N' respectively. If you want to have a confirmation that can be cancelled with ESC try: (MessageBox new caption: 'Sure'; okCancel) open Of course you can add a helper method on the class side of MessageBox to make this easier if you wish. Best regards Andy Bower Dolphin Support www.object-arts.com |
On 14 Sep 2004 08:57:22 GMT, Andy Bower <[hidden email]>
wrote: > Hi, > >> Just noticed that the messagebox below is not cancelled by Esc. >> Shouldn't it? >> >> =============== >> MessageBox confirm: 'Sure?' >> =============== > > No, I don't think so. The ESC key is normally bound to a Cancel button > whereas the above MessageBox is displayed with Yes and No buttons. > You'll find that the keyboard shortcuts for these are 'Y' and 'N' > respectively. > > If you want to have a confirmation that can be cancelled with ESC try: > > (MessageBox new caption: 'Sure'; okCancel) open > > Of course you can add a helper method on the class side of MessageBox > to make this easier if you wish. Hmm.. no that would change how it looks (as in OK/Cancel instead of Yes/No). I saw this behavior (of ESC triggering the 'No') in the Windows Explorer confirmation dialog when you try to delete a file, and thought it rather natural, probably because I was so used to pressing a Enter/ESC when I see a dialog box. If I do need to wire ESC to cancel, is there an easy way to do it? -- Regards Hwee Boon MotionObj |
"Yar Hwee Boon" <[hidden email]> wrote in message
news:[hidden email]... > On 14 Sep 2004 08:57:22 GMT, Andy Bower <[hidden email]> > wrote: > >> Hi, >> >>> Just noticed that the messagebox below is not cancelled by Esc. >>> Shouldn't it? >>> >>> =============== >>> MessageBox confirm: 'Sure?' >>> =============== >> >> No, I don't think so. The ESC key is normally bound to a Cancel button >> whereas the above MessageBox is displayed with Yes and No buttons. >> You'll find that the keyboard shortcuts for these are 'Y' and 'N' >> respectively. >> >> If you want to have a confirmation that can be cancelled with ESC try: >> >> (MessageBox new caption: 'Sure'; okCancel) open >> >> Of course you can add a helper method on the class side of MessageBox >> to make this easier if you wish. > > Hmm.. no that would change how it looks (as in OK/Cancel instead of > Yes/No). I saw this behavior (of ESC triggering the 'No') in the Windows > Explorer confirmation dialog when you try to delete a file, and thought it > rather natural, probably because I was so used to pressing a Enter/ESC > when I see a dialog box. If I do need to wire ESC to cancel, is there an > easy way to do it? > No, I don't think so because we are using the native message box and it takes away most control. I'm sure it could be done, but we would not recommend it because that is not the way message boxes normally work on Windows. The explorer dialog you mention is not a message box, and so does follow the built-in dialog behaviour of closing with no action when you press Esc. I don't know why Windows behaves in these ways, but I would guess that the fact that Yes/No MBs do not respond to Esc is deliberate. Regards Blair |
Free forum by Nabble | Edit this page |