Azzera filtri
Azzera filtri

SelectionHighlight of line always appears on 'top'?

2 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Saurabh Gupta
Saurabh Gupta il 15 Feb 2017
(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 Commento
Felix Ruhnow
Felix Ruhnow il 21 Feb 2017
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

Accedi per commentare.

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by