Why not pop-up a TextInput?

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Miller
Sent: Wednesday, September 10, 2008 7:30 PM
To: [email protected]
Subject: Re: [flexcoders] Creating a popup Menu input

 

Good to know. I'll use PopUpButton instead.

 

 

Thanks Alex!

~Aaron

On Wed, Sep 10, 2008 at 4:14 PM, Alex Harui <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

How about PopUpButton instead.  I don't really want to dig into editable
Menus.  It wasn't intended behavior

 

From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]> ]
On Behalf Of Aaron Miller
Sent: Wednesday, September 10, 2008 3:18 PM
To: [email protected] <mailto:[email protected]> 
Subject: [flexcoders] Creating a popup Menu input

 

Hello, 

 

I want to have a quick little popup text input so I am using a Menu
component set to editable and using an item renderer. I've almost got it
working, except I get a null property error when hit enter (coming from
List.itemEditorItemEditBeginHandler).

 

Here is my menu creation code:

 

==========================

private function onBranchCategoryClick(): void {

            var menuLoc:Point = new Point();

            var menu:Menu;

            

            // Calculate position of Menu in Application's coordinates. 

            menuLoc.x = idBranchCategoryBtn.x + 10;

            menuLoc.y = idBranchCategoryBtn.y +
idBranchCategoryBtn.height + 20;  

            menuLoc = this.localToGlobal(menuLoc);

 

            menu = Menu.createMenu(Application(Application.application),
[''], false);

            menu.width = 100;

            menu.height = 25;

            menu.editable = true;

            menu.itemRenderer = new
ClassFactory(pkg.renderers.BranchCategoryMenuRenderer);

            //menu.rendererIsEditor = true;

            menu.addEventListener( "itemClick",
handleCategoryBranchSelected );

            menu.show(menuLoc.x, menuLoc.y);

}

==========================

 

And the item renderer code:

==========================

<?xml version="1.0" encoding="utf-8"?>

<mx:TextInput xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " text="{data}"

            implements="mx.controls.menuClasses.IMenuItemRenderer"
change="data = this.text">

<mx:Script>

<![CDATA[

import mx.controls.Menu;

 

import pkg.models.products.ProductNode;

 

 

public function get menu():Menu {

            return null;

}

 

public function set menu(data:Menu):void {

            

}

 

public function get measuredBranchIconWidth(): Number { return 0; }

 

public function get measuredIconWidth(): Number { return 0; }

 

public function get measuredTypeIconWidth(): Number { return 0; }

]]>

</mx:Script>

            

</mx:TextInput>

==========================

 

In my itemClick handler, event.item contains the string that was entered
and the error occur right after the handler call.

 

 

Could anyone please tell me what I'm doing wrong?

 

 

Thanks!

~Aaron

 

 

 

Reply via email to