• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 440
  • Last Modified:

Remove focus from ItemRenderer

I'm having a heck of a time getting an itemRenderer on a Tree object to either fire the ItemEditEnd event of remove focus from the editor.

I need to give users 2 buttons on an itemrenderer that I'm using to edit Tree values.  I have an OK and a Cancel button.

The Cancel button is easy.

I'd rather have the default itemEditEnd Event handle the behavior and updates.  The question is how can I trigger that event via the 'OK" button.

Any ideas?


Here is my Edit component - nothing special:
<s:Panel x="10" y="10" width="250" height="131" id='EditPanel' title="Enter a new label">
			<s:Label id="labelDisplay" x="25" y="10"/>
			<s:TextInput id="picklistEditText" x="25" y="39" width="150" text=' ' />
			<s:Button x="1" y="67" label="OK" click='onClick()'/>
		<s:Button x="178" y="67" label="Cancel" click="parentDocument.mytreeEdit.destroyItemEditor(); "/>

Open in new window

I was trying to remove the focus from the editor:

private function onClick():void {
				stage.focus = null;

That doesn't seem to work.

Open in new window

I also tried to dispatch a manual keyboard stroke:

private function onClick(value:Object):void {
				var list:Tree = Tree(owner);
				list.callLater(dispatchEvent, [new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, Keyboard.ENTER, Keyboard.ENTER)]);	

That doesn't seem to work..

Open in new window

  • 3
  • 2
1 Solution
zzynxSoftware engineerCommented:
I think that last onClick() version should work in combination with the information you can find @ http://livedocs.adobe.com/flex/3/html/help.html?content=celleditor_7.html
zzynxSoftware engineerCommented:

Have you tried with : this.stage.focus = null; ?

Otherwise as another workaround you can set the focus to another object doing : myOkButton.setFocus();

Let me know if it helps.


IT Degree with Certifications Included

Aspire to become a network administrator, network security analyst, or computer and information systems manager? Make the most of your experience as an IT professional by earning your B.S. in Network Operations and Security.

thebellmanAuthor Commented:
The solution was to simply set focus on something else in the parent application -


The button:

<s:Button x="1" y="67" label="OK" click='cbSelected=picklistEditText.text;parentDocument.hbFlexHeightEdit.setFocus();'/>

Where hbFlexHeightEdit is the HBox that holds the Tree that is being edited.

zzynxSoftware engineerCommented:
>> The solution was to simply set focus on something else in the parent application
Then, don't you think aubweb deserve the/some points?
thebellmanAuthor Commented:
Thanks - simple and it worked!

Featured Post

Managing Security & Risk at the Speed of Business

Gartner Research VP, Neil McDonald & AlgoSec CTO, Prof. Avishai Wool, discuss the business-driven approach to automated security policy management, its benefits and how to align security policy management with business processes to address today's security challenges.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now