2.x or 3.0?  In 2.x, mouseEnabled=false and may affect ContextMenu.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Jeff Schuenke
Sent: Tuesday, October 16, 2007 9:43 AM
To: [email protected]
Subject: [flexcoders] tree itemRenderer problem

 


Hi,

I have created a custom itemRenderer for a tree control to handle
dynamiclly loaded icon image. I'd also like to add a unique context menu
to each item. I have assigned a context menu to the label and icon, but
only the icon menu appears. I then tried to combine the icon and label
into a container and assign the contextMenu to the container object, but
that has the same result, only the icon seems to trigger the vent to
open the context menu. It seems as if the label will not generate an
open event.

I built a test case with just a label in a container (no tree involved)
and it does indeed generate a context menu open event. I cannot
understand why the label behaves differently inside the itemRenderer
context.

My custom Itemrendere is based on the existing TreeItemRenderer class. 
It is identical, with some modifcation to the code to load a custom icon
and add the context Menu. Here is a snippet of code that adds the
context menu: (located inside the "commitProperties" method of the
class)

label.text = _listData.label;
label.multiline = listOwner.variableRowHeight;
label.wordWrap = listOwner.wordWrap;
label.toolTip = [EMAIL PROTECTED];

var labelMenuItem:ContextMenuItem = new ContextMenuItem("labelMenu");
label.contextMenu = new ContextMenu();
label.contextMenu.hideBuiltInItems();
label.contextMenu.customItems = [labelMenuItem];

var iconMenuItem:ContextMenuItem = new ContextMenuItem("iconMenu");
icon.contextMenu = new ContextMenu();
icon.contextMenu.hideBuiltInItems();
icon.contextMenu.customItems = [iconMenuItem];

The iconMenu appears bu the lebel menu does not.

Jeff

 

Reply via email to