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!