SelectionHighlight of line always appears on 'top'?
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!