필터 지우기
필터 지우기

SelectionHighlight of line always appears on 'top'?

조회 수: 3 (최근 30일)
Felix Ruhnow
Felix Ruhnow 2017년 2월 6일
댓글: Felix Ruhnow 2017년 2월 21일
Hello,
I have several graphics objects that include line objects and I use 'Selected' as well as 'SelectionHighlight' to visualize user-selected objects. Unfortunately, the markers of the SelectionHighlight always appear on top of all other graphics objects and therefore render the 'UIContextMenu' of overlaying graphics objects obsolete. If there a option to control in which position (uistack doesn't work) the SelctionHighlight appears?
Some code:
ax = axes;
l1 = line([0 1:0.01:2 3],[1 ones(1,101) 3],'color','b');
l2 = line([0 1:0.01:2 3],[0 ones(1,101) 1],'color','r');
c = uicontextmenu;
m = uimenu(c,'Label','red');
l2.UIContextMenu = c;
l1.SelectionHighlight='on';
l1.Selected='on';
uistack(l2,'top');
t = text(1.5,1,'test','Fontsize',20,'Backgroundcolor','r');
ct = uicontextmenu;
mt = uimenu(ct,'Label','text');
t.UIContextMenu = ct;
uistack(t,'top');
The UIContextMenu for the red line or the text is not accessible if SelectionHighlight is 'on' even though both graphics objects are 'in front' of the blue line.
Thanks, Felix

답변 (1개)

Saurabh Gupta
Saurabh Gupta 2017년 2월 15일
(1) uistack is designed for changing the "visual stacking order of UI objects", whereas line and text are not UI objects.
(2) The issue is that you have set the line 'l1' as 'Selected', which makes it appear on top of its siblings. I think you should perform toggling of the Selected and SelectionHighlight properties in suitable callback functions for more refined interactive control.
  댓글 수: 1
Felix Ruhnow
Felix Ruhnow 2017년 2월 21일
Yeah, it's only code for demonstration purpose. The main thing I wanna do is displaying mouse hover information, which includes a context menu that should work whether SelectionHiglight is activated (and selected) or not. I bascially need a way to reorder the graphics objects (especially the markers of the SelectionHighlight). Thanks

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by