Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
context menu on a list

Subject: context menu on a list

From: Kamran

Date: 12 Aug, 2009 08:44:20

Message: 1 of 5

Hi,

if a context menu is activated when right clicking on a list, is there a
way of knowing which item in the list was licked on ?

Thanks in advance,

Subject: context menu on a list

From: Bruno Luong

Date: 12 Aug, 2009 13:17:20

Message: 2 of 5

Kamran <kamran@uio.no> wrote in message <h5tvd4$b2a$1@news01.tp.hist.no>...
> Hi,
>
> if a context menu is activated when right clicking on a list, is there a
> way of knowing which item in the list was licked on ?
>
> Thanks in advance,

Juts get the 'Value' property of the list handle when the callback is invoked as like anywhere else.

Bruno

Subject: context menu on a list

From: us

Date: 12 Aug, 2009 13:27:19

Message: 3 of 5

Kamran <kamran@uio.no> wrote in message <h5tvd4$b2a$1@news01.tp.hist.no>...
> Hi,
>
> if a context menu is activated when right clicking on a list, is there a
> way of knowing which item in the list was licked on ?
>
> Thanks in advance,

no, the current stock-callback only responds to LEFT clicks...
however, see the many FEX contributions by yair altman

http://www.mathworks.com/matlabcentral/fileexchange/authors/27420

as well as his nice UNDOC w3 site

http://UndocumentedMatlab.com

us

Subject: context menu on a list

From: Kamran

Date: 13 Aug, 2009 05:50:48

Message: 4 of 5

us wrote:
> Kamran <kamran@uio.no> wrote in message <h5tvd4$b2a$1@news01.tp.hist.no>...
>> Hi,
>>
>> if a context menu is activated when right clicking on a list, is there a
>> way of knowing which item in the list was licked on ?
>>
>> Thanks in advance,
>
> no, the current stock-callback only responds to LEFT clicks...
> however, see the many FEX contributions by yair altman
>
> http://www.mathworks.com/matlabcentral/fileexchange/authors/27420
>
> as well as his nice UNDOC w3 site
>
> http://UndocumentedMatlab.com
>
> us

Thanks,
That is exactly what I am trying to do, i.e. make it respond to RIGHT
click. Thanks for the links.

Kamran

Subject: context menu on a list

From: Yair Altman

Date: 13 Aug, 2009 22:36:07

Message: 5 of 5

Kamran <kamran@uio.no> wrote in message <h609jp$ul5$1@news01.tp.hist.no>...
> us wrote:
> > Kamran <kamran@uio.no> wrote in message <h5tvd4$b2a$1@news01.tp.hist.no>...
> >> Hi,
> >>
> >> if a context menu is activated when right clicking on a list, is there a
> >> way of knowing which item in the list was licked on ?
> >>
> >> Thanks in advance,
> >
> > no, the current stock-callback only responds to LEFT clicks...
> > however, see the many FEX contributions by yair altman
> >
> > http://www.mathworks.com/matlabcentral/fileexchange/authors/27420
> >
> > as well as his nice UNDOC w3 site
> >
> > http://UndocumentedMatlab.com
> >
> > us
>
> Thanks,
> That is exactly what I am trying to do, i.e. make it respond to RIGHT
> click. Thanks for the links.
>
> Kamran

I've just uploaded a new post that explains exactly how to trap mouse right-clicks and other mouse events on listboxes. This can be used to set dynamic context-menus and dynamic tooltips, based on the actual item beneath the mouse cursor (instead of the static context-menu and tooltip that standard Matlab enables):

http://UndocumentedMatlab.com/blog/setting-listbox-mouse-actions/

Enjoy :-)

Yair Altman
http://UndocumentedMatlab.com
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us