Where is a list of eventtypes for listeners?
이전 댓글 표시
Usually I think MATLAB has excellent documentation, but there are occasions when I have to pull my hair out looking for something. So when referring to this example solution posted by TMW, it seems we can add an eventlistener to a uicontrol with an eventtype of 'ActionEvent'. But when I use this example I get the following warning message in r2011b:
Warning: The specified event will be removed in a future release.
Please use the following event instead: ContinuousValueChange
So the obvious question is:
What are all of the choices when setting eventtypes for listeners?
I have searched everywhere I can think of for a list of such events but found nothing. Is this yet another instance of non-documentation in MATLAB or have I just not been able to find it?
Does anyone know of such a list in the doc? I want to find something like this list of axes properties but for events or listeners. On that list would be 'ActionEvent' and 'ContinuousValueChange' at least.
댓글 수: 3
Daniel Shub
2012년 12월 12일
I cannot even find documentation on handle.listener. I wonder if this is a result of undocumented functionality associated with hg2.
Jan
2012년 12월 12일
The addlistener command works for many years now, so it is not connected to HG2. The M-file contains some documentation, but you do not find it in the docs, as far as I remember.
Vishal Rane
2013년 8월 27일
Matt, did you find any list or documentation for this?
답변 (2개)
Jim Hokanson
2015년 2월 11일
For hg1, events can be found tin the schema.class object
h = uicontrol('style','slider')
class_info = classhandle(handle(h))
events = class_info.Events;
event_names_local = cell(1,length(events));
for iEvent = 1:length(events)
event_names_local{iEvent} = events(iEvent).Name;
end
For hg2, things are much easier, just reference the metaclass
class_info = metaclass(graphics_handle);
event_names_local = {class_info.EventList.Name};
'ActionEvent' is an event in the schema.class (UDD)
'ContinuousValueChange' is an event in hg2
I have no idea where to find a list of newer events (i.e. ContinuousValueChange when using hg1)
To be a bit more thorough, one could also examine the accompanying Java object using findjobj (FEX). Then you would need to search for properties with a 'Callback' with an accompanying 'CallbackData'
Note, one would also want to examine the properties for ones that are observable. This should be fairly straightforward using a similar approach as was used for events.
Jim
Malcolm Lidierth
2013년 5월 26일
0 개 추천
@Matt
As the uicontrols use Java under the hood, see the available Java listeners at
The link above is now broken but I'll guess the UI was a slider or something of that sort which calls a stateChange rather than event listener.
MATLAB collapse these into their 'Callback'. I have always preferred to stick with documented components - so I use Java for GUIs in MATLAB not MATLAB uicontrols. TMW may not document them, but Sun/Oracle do of course.
댓글 수: 4
Image Analyst
2013년 5월 26일
The link worked for me.
Malcolm Lidierth
2013년 5월 26일
@IA
There are two links, the first does not work: at least insofar that it now only brings up a page that says "Oops". So its broken according to the formal definition of the term given here:
!
Image Analyst
2013년 5월 26일
I only saw one link that you listed - the one at docs.oracle.com, and clicking on it brings up a page that says
"Listener API Table
In the table that follows, the first column gives...."
Malcolm Lidierth
2013년 5월 26일
IA
Oops. I meant the OPs first link. Probably best to break this LOop.
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!