octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need someone to test uimenu features on ML


From: Søren Hauberg
Subject: Re: Need someone to test uimenu features on ML
Date: Wed, 12 Oct 2011 07:54:09 +0200

tir, 11 10 2011 kl. 23:14 +0100, skrev Michael Goffioul:
> On Tue, Oct 11, 2011 at 7:18 PM, Søren Hauberg <address@hidden> wrote:
> > Hi
> >
> > tir, 11 10 2011 kl. 16:45 +0100, skrev Michael Goffioul:
> >> 1) callback propagation through menu hierarchy:
> >>
> >> h0 = uimenu ('label', 'Level 0', 'callback', @() disp('level 0'));
> >> h1 = uimenu (h0, 'label', 'Level 1', 'callback', @() disp('level 1'));
> >> h2 = uimenu (h1, 'label', 'Level 2', 'callback', @() disp('level 2'));
> >
> > I get some errors here
> >
> > ??? Error using ==> @()disp('level 0')
> > Too many input arguments.
> 
> Sorry for that. Please replace "@()" with "@(h,e)" in the 3 above statements.

The I get

level 0

(when I hover over 'Level 0')

level 1

(when I hover over 'Level 1')

level 2

(when I click 'Level 2')

> >> 2) case-sensitive accelerators
> >>
> >> h0 = uimenu ('label', 'My Menu');
> >> h1 = uimenu (h0, 'label', 'Normal', 'accelerator', 'z');
> >> h2 = uimenu (h0, 'label', 'Shifted', 'accelerator', 'Z');
> >>
> >> Then check the accel displayed in the menu and try the following
> >> key sequences when the figure has the focus:
> >
> > I might be doing things wrong, but... When I click on 'My Menu' I get to
> > choose between 'Normal' and 'Shifted' and both have the accelerator
> > "Ctrl+z". When I click CTRL+Z or CTRL+SHIFT+Z then nothing happens.
> 
> It's normal nothing happens, no callback is defined. Could you add a
> callback to both menu items to see which one is triggered.

Ok. I did:

h1 = uimenu (h0, 'label', 'Normal', 'accelerator', 'z', 'callback',
@(h,e) disp ('normal'));
h2 = uimenu (h0, 'label', 'Shifted', 'accelerator', 'Z', 'callback',
@(h,e) disp ('shifted'));

When I click the menus the correct callback is called. When I press CTRL
+Z 'shifted' is printed and when I press CTRL+SHIFT+Z nothing happens.
So, it seems like Matlab is case-insensitive when callbacks are
registered, but case-sensitive when accelerators are pressed. Seems like
a strange behaviour to me...

> Now, it looks like accelerators are case-insensitive in ML. But I tempted
> to extend that to support SHIFT modifier. That is, if accelerator == 'z',
> translate it into CTRL+Z, it accelerator == 'Z', translate into CTRL+SHIFT+Z.
> 
> This wouldn't be strictly compatible with Matlab, but this would add more
> flexibility to the accelerator system. Any other opinion?

I think your approach is more sensible than the Matlab behaviour (which
feels more like a bug than a design decision to me), so I'd go with
that.

Søren



reply via email to

[Prev in Thread] Current Thread [Next in Thread]