Hi,
Problem in your CellEditor.as code,
_cm.customItems.push(new ContextMenuItem(new ContextMenuItem("Details",
details)))
*Nested ContextMenuItem(...)
##Corrected Code##
class CellEditor extends mx.controls.TextInput
{
function CellEditor()
{
var _cm = new ContextMenu();
_cm.customItems.push(new ContextMenuItem("Details",
details));
this.label.menu = _cm;
}
function details(item:mx.controls.TextInput,
mi:ContextMenuItem) :Void
{
trace("Selected " + mi.caption);
}
}
-abdul
-----Original Message-----
From: viraf_bankwalla [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 26, 2005 4:12 AM
To: [email protected]
Subject: [flexcoders] Re: edit ContextMenu
Thanks - I tried it but it does not seem to be working.
Any suggestions ?
------- application
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*">
<CellEditor text="Hello" editable="true" />
</mx:Application>
--------- class
class CellEditor extends mx.controls.TextInput
{
function CellEditor()
{
var _cm = new ContextMenu();
_cm.customItems.push(new ContextMenuItem(new
ContextMenuItem("Details", details)));
this.label.menu = _cm;
}
function details(item:mx.controls.TextInput,
mi:ContextMenuItem) :Void
{
trace("Selected " + mi.caption);
}
}
--- In [email protected], Abdul Qabiz <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Try this:
>
>
> _ti.label.menu = cm;
>
> Where _ti is instance of TextInput.
>
>
> ###Modified Code##
>
> class CellEditor extends mx.controls.TextInput
> {
> var _cm = null;
>
> function CellEditor()
> {
> _cm = new ContextMenu();
> _cm.customItems.push(new ContextMenuItem(new ContextMenuItem
> ("Details", details)));
> this.label.menu = _cm;
> }
>
> function details(item:mx.controls.TextInput,
> mi:ContextMenuItem) :Void
> {
> trace("Selected " + mi.caption);
> }
> }
>
>
> -abdul
>
>
>
> -----Original Message-----
> From: viraf_bankwalla [mailto:[EMAIL PROTECTED]
> Sent: Saturday, March 26, 2005 2:26 AM
> To: [email protected]
> Subject: [flexcoders] edit ContextMenu
>
>
>
> When I right-click in a TextInput I get the edit menu. How do I
add
> items to this edit ContextMenu ? I tried the following, however
the
> compiler complains that there is no property with the name Menu.
>
> class CellEditor extends mx.controls.TextInput
> {
> var _cm = null;
>
> function CellEditor()
> {
> _cm = new ContextMenu();
> _cm.customItems.push(new ContextMenuItem(new ContextMenuItem
> ("Details", details)));
> this.menu = _cm;
> }
>
> function details(item:mx.controls.TextInput,
> mi:ContextMenuItem) :Void
> {
> trace("Selected " + mi.caption);
> }
> }
>
> Thanks
>
>
>
>
>
>
> Yahoo! Groups Links
Yahoo! Groups Links
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/