Default figure property doesn't seem to be working properly

조회 수: 3 (최근 30일)
Paul Mennen
Paul Mennen 2022년 3월 11일
답변: Paul Mennen 2022년 3월 11일
There is a new text property introduced in Matlab R2021b called 'interactions' that is causing me problems, so after I create my figure I set the default value as follows:
set(FigHandle,'defaulttextinteractions',[]);
But then after my axes have been created, I search for one of the axis lables and check it's interactions property as follows:
a = findobj('string','Micro-seconds');
get(a,'interactions')
ans =
EditInteraction with no properties.
Also I checked the axis default as follows:
get(gca,'defaulttextinteractions')
ans =
[]
This indicates the default values are not being observed, because if they were, the axis label would have been created with a text object with a null interaction value.
If I manually change this property for this particular text object by typing:
set(a,'interactions',[])
Then the text object behaves as it does with earlier Matlab versions (and the way I want it to behave).
But it would be a real pain to go thru my entire program and set each text object individually with this null property value. This is why Matlab has default property values, but in this case it doesn't seem to be working. Does anyone have a suggestion for how to get it to work?
Thanks for any advice you can offer
~Paul
  댓글 수: 1
Image Analyst
Image Analyst 2022년 3월 11일
What does this new property do? If you set it to null, and then ask what it is and it tells you it is null, why is that surprising?
The axis label is a different object than the axis. I think it's a child object so could/would/might have different properties than the parent container object.
Also I don't believe setting a figure property means that all axes on the figure, and all other widgets on the figure, will get the same properties with the same values.

댓글을 달려면 로그인하십시오.

답변 (1개)

Paul Mennen
Paul Mennen 2022년 3월 11일
> What does this new property do?
I believe the idea of this new property is to allow the user to edit the value of the string by clicking on it. However in my program I use clicking on these strings for other purposes and so my program doesn't behave the way I want it to, and the way it does under ealier versions of Matlab (that don't have this property)
> If you set it to null, and then ask what it is and it tells you it is null, why is that surprising?
I never said it was surprising. When I set the property of a specific text object to null, then the object behaves properly (or should I say the way I want it to). My beef was that I shouldn't have to set this property individually for each text object. This is what default property values are for.
My understanding is that setting a default for a figure means that any object created inside that figure should use that default.
It seems that the values for 'defaulttextinteractions' is set to null for both figures and axes. This is as it should be so that compatibility is maintained with older versions of Matlab where text objects behave as if this property (if it existed) was set to null. The problem is that when you actually create a text object (no matter if it is an axis label or an object created with the text command) the text object does not have a null value for this new property. Either that means something is broken ... or perhaps I don't really understand how default property values work.
~Paul

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by