Getting back to this issue ...

As near as I can tell, when the DG gets an exception,
DataGrid.focusOutHandler was
never called.

Instead, calling  _popup.setFocus(); in the creationComplete handler for
my item-editor triggers a call to itemEditorFocusOutHandler, which ends up
calling mx:DataGrid.contains() event.relatedObject which is equal to the
UITextField
which is owned by the  TextField which is  owned by my Popup class which
is owned by the mx:DataGrid.

But itemEditorFocusOutHandler() doesn't call owns() or
itemRendererContains();
it just calls contains().

I tried moving the setFocus into the INITIALIZE event handler, but that's
apparently
too early to setFocus because then I get an exception trying to setFocus.

I can't use my own FOCUS_OUT event handler on the item editor to cancel the
event
when the popup is receiving focus, because FOCUS_OUT is not cancelable.

I can't override the DataGrid.itemEditorFocusOutHandler() because it's
private.

Any other suggestions?

Thanks,
Glenn

On Tue, Jul 29, 2008 at 1:20 PM, Alex Harui <[EMAIL PROTECTED]> wrote:

>    focusOutHandler should have called itemRendererContains with your
> custom class and that textfield and the owner chain should have gotten from
> the textfield to the custom class.  It shouldn't matter what the parent is,
> you want it to be the systemManager.  It should be the fifth "if" statement
>
>
>  ------------------------------
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Glenn Jones
> *Sent:* Tuesday, July 29, 2008 9:16 AM
> *To:* flexcoders@yahoogroups.com
>
> *Subject:* Re: [flexcoders] TextArea popup editor in DataGrid
>
>
>
> I trapped in DataGrid.itemEditorFocusOutHandler() - the chain of 'owner'
> values for event.relatedObject
> does goes back to the grid, but the chain of 'parent' values does not.
>
> The event.relatedObject is type UITTextField  The owner & parent of
> UITextField is an instance of TextArea.
> This is the instance managed by PopUpManager. The TextArea.owner =
> myCustomClass (the item editor instance),
> but TextArea.parent is an instance of myApp_mx_managers_SystemManager.
>
> I tried calling addChild() with the popup TextArea instance, but it really
> didn't lilke that - apparently PopUpManager
> likes to parent all of the popups (which makes sense).
>
> Any other suggestions or have I reached a dead-end with this approach?
>
> Thanks for your help,
> Glenn
>
> On Mon, Jul 28, 2008 at 11:41 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> Walk through the focusOutHandler on DataGrid.  In theory, if the object
> getting focus is owned by the itemeditor, it shouldn't try to end the edit
> session.
>
>
>  ------------------------------
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Glenn Jones
> *Sent:* Monday, July 28, 2008 3:41 PM
> *To:* flexcoders@yahoogroups.com
> *Subject:* Re: [flexcoders] TextArea popup editor in DataGrid
>
>
>
> I've tried using a popup TextArea but I'm having real problems trying to
> get it to work as an item editor
> within a datagrid.
>
> My business requirements are
>
> - someone can click in the DG cell to start editing. If the cell uses a
> TextArea control, they should get popup-like TA that extends across rows to
> enter longer blocks of text
> - the user can enter data in any text-based editable cell without using a
> mouse (but they can use a mouse if they want to)
> - someone can tab across a row in the DG; our DG needs to move from one
> editable cell to the next (and go to next editable row if they tab out of
> the last editable cell in a row)
> - the user can use shift-tab to go to previous editable cell
> - the user can use ENTER to finish the edit and save the row
> - the user can use ESCAPE to cancel the edit
>
> So I've already got all of the keyboard behavior working with a TextField
> controls. It also works if I use a simple TextArea as the item editor (but
> see if the beginning of the thread for my problem with a simple TextArea).
>
> However, when I open the TextArea with a PopUpManager I'm having problems.
> My custom item editor is composed of a Canvas:
>
>     public class PopUpTextArea extends Canvas
>         implements IDropInListItemRenderer, IFocusManagerComponent
>
> On creationComplete, the editor creates a new instance of TextArea, and
> uses PopUpManager to open it.
>
>                 _popup = new TextArea();
>                 _popup.width= this.width;
>                 _popup.height= EDIT_HEIGHT;
>                 _popup.text = this._text;
>                 _popup.owner = this;
>
>                 PopUpManager.addPopUp(_popup, this, false);
>                 PopUpManager.bringToFront(_popup);
>
> But ...
>
> If I try to programmatically set focus on the popup, the DG crashes.
> Apparently, it's getting wrapped around a pole somehow because setting focus
> on the popup triggers an item-edit-end.  If I click in the TA, it either
> (A) goes in a little circle - item-edit-end is called because the Canvas
> losses focus, so it
> closes the TA, but the editedItemPosition doesn't move, so it creates a new
> instance of the editor which opens the popup, or (B) it just closes the
> item-editor
> because the item-editor lost focus
>
> I also tried to capture keystrokes on the Canvas and pass them to the TA,
> that didn't work either. But even if it did work, the user still needs the
> ability
> to use the mouse if they want to.
>
> So is it possible to use a TextArea in a PopUp as an item editor in a
> DataGrid?
>
> On Fri, Jul 18, 2008 at 4:42 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> Well, you could popup a TextArea like PopUpButton does, but it sounds like
> your real goal is to have the TA extend across rows and not be below the
> lines.  I assume you don't want the TA to fit within a single row?
>
>
>
> How will you handle the area at the bottom of the DG?  If I click the last
> row, should the TA extend two rows below the DG?
>
>
>  ------------------------------
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Glenn Jones
> *Sent:* Friday, July 18, 2008 11:17 AM
> *To:* flexcoders@yahoogroups.com
> *Subject:* [flexcoders] TextArea popup editor in DataGrid
>
>
>
> I have a DataGrid where one of the columns is a TextArea control as the
> itemEditor.
>
> When I edit a cell in the column with the TextArea editor, the TextArea
> opens up to a height equivalent to
> three rows of data in the grid. The editor works fine; in fact it's been
> working this way for some time.
>
> But recently, we enabled horizontal and vertical grid lines on the grid.
> When the TextArea editor opens up,
> the datagrid horizontal grid lines are drawn across the top of the control.
>
> I've verified that the TextArea control is not inheriting the styles
> related to grid lines
> I've verified that the TextArea backgroundAlpha is 1; i.e. the text on the
> rows underneath the editor is not
> showing through.
>
> So as near as I can tell, the grid is drawing the gridlines on top of the
> editor.
>
> Curiously, I also have a PopUpButton editor type - it does not have grid
> lines drawn across when the dropdown
> area that appears when the button is activated.
>
> Is this a known issue? Is there a workaround?
>
> Thanks
>
>
>
>
>
>  
>

Reply via email to