thebellman
asked on
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?
Thanks.
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?
Thanks.
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(); "/>
</s:Panel>
I was trying to remove the focus from the editor:
private function onClick():void {
stage.focus = null;
}
That doesn't seem to work.
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..
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
Wrong link. I meant this: http://livedocs.adobe.com/flex/3/html/help.html?content=celleditor_6.html#208069
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The solution was to simply set focus on something else in the parent application -
parentDocument.hbFlexHeigh tEdit.setF ocus();
The button:
<s:Button x="1" y="67" label="OK" click='cbSelected=picklist EditText.t ext;parent Document.h bFlexHeigh tEdit.setF ocus();'/>
Where hbFlexHeightEdit is the HBox that holds the Tree that is being edited.
Thanks!
parentDocument.hbFlexHeigh
The button:
<s:Button x="1" y="67" label="OK" click='cbSelected=picklist
Where hbFlexHeightEdit is the HBox that holds the Tree that is being edited.
Thanks!
>> The solution was to simply set focus on something else in the parent application
Then, don't you think aubweb deserve the/some points?
Then, don't you think aubweb deserve the/some points?
ASKER
Thanks - simple and it worked!