フィルターのクリア

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 Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by