[flexcoders] Re: Clear user text after enter on TextInput (gumbo and/or moxie)

2009-06-15 Thread valdhor
Try...

(event.target as TextInput).text = ;

(event.target as TextInput).setFocus();


HTH



Steve


--- In flexcoders@yahoogroups.com, gwangdesign gwangdes...@... wrote:

 Hello,
 
 I have a TextInput, say, for user to type in to search something. After the 
 user presses enter Key, I want the TextInput to clear the user input text 
 while still staying in focus, so that the user can continue to type in other 
 words.
 
 I had a hard time to do this for a TextInput (either Gumbo or Flex 3, 
 although they seemingly behave differently.)
 
 For mx:TextInput, I am not even able to clear the user input text by handling 
 the enter event:
 
 private function mxTI_handleEnter(event:FlexEvent):void
   {
   trace(mxTI_handleEnter);
   mx.controls.TextInput(event.currentTarget).text = ;
   }
 
 Doesn't do anything, even though the setter for text value does get called. 
 Same thing for mx.controls.TextInput(event.currentTarget).htmlText= ;
 
 For s:TextInput, setting text property to  does clear the user text but I 
 lost caret inside the TextField in the TextInput. I have to click the 
 TextInput to regain focus in order to enter something.
 
 BTW, I am not sure if this behavior is something expected from user 
 experience point of view since I looked at Google, Yahoo! and Bing, all of 
 them did the same thing: once you pressed enter, the search textinput lost 
 focus. You would have to regain focus for the textinput to do another search.
 
 Sorry for the long text Hope this makes sense. Anyhow, is this something 
 doable? Thanks.





[flexcoders] Re: Clear user text after enter on TextInput (gumbo and/or moxie)

2009-06-15 Thread gwangdesign
 Try...
 
 (event.target as TextInput).text = ;
 
 (event.target as TextInput).setFocus();
 

Steve, Thanks for the lead. Unfortunately, it doesn't work, either for the 
Gumbo or Halo component.

For mx:TextInput:

The text never gets cleared out after user presses the enter key;

For s:TextInput:

The text is cleared out but the caret disappears, while the textinput still 
gets focus. User has to regain focus on the textinput by first clicking 
somewhere else. And this behavior cannot be programmatically emulated:

anotherComp.setFocus();
(event.target as TextInput).text = ; 
(event.target as TextInput).setFocus();  

I am wondering if it's good on the first place to handle this on the enter 
event of a TextInput component.



[flexcoders] Re: Clear user text after enter on TextInput (gumbo and/or moxie)

2009-06-15 Thread valdhor
This works for me (I am using Flex 3.3 with Flash Player 9.0.159)

If this is not a player or Gumbo issue, I would look at other things happening 
after the enter event.

What happens with a small test case?


--- In flexcoders@yahoogroups.com, gwangdesign gwangdes...@... wrote:

  Try...
  
  (event.target as TextInput).text = ;
  
  (event.target as TextInput).setFocus();
  
 
 Steve, Thanks for the lead. Unfortunately, it doesn't work, either for the 
 Gumbo or Halo component.
 
 For mx:TextInput:
 
 The text never gets cleared out after user presses the enter key;
 
 For s:TextInput:
 
 The text is cleared out but the caret disappears, while the textinput still 
 gets focus. User has to regain focus on the textinput by first clicking 
 somewhere else. And this behavior cannot be programmatically emulated:
 
 anotherComp.setFocus();
 (event.target as TextInput).text = ; 
 (event.target as TextInput).setFocus();
 
 I am wondering if it's good on the first place to handle this on the enter 
 event of a TextInput component.





[flexcoders] Re: Clear user text after enter on TextInput (gumbo and/or moxie)

2009-06-15 Thread gwangdesign
--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 This works for me (I am using Flex 3.3 with Flash Player 9.0.159)
 
 If this is not a player or Gumbo issue, I would look at other things 
 happening after the enter event.
 
 What happens with a small test case?

Steve, Thanks for the lead.

As I found out, it seems to be the issue when I targeting Flash Player 10. The 
code:

myTextInput.text = ;
//myTextInput.setFocus();// no need to call this.

works exactly as I expect (clearing the previous text entry, with TextInput 
remaining in focus) for an mx:TextInput when compile against FP 9.

Once I target FP10, myTextInput.text =  stops working (text not cleared out 
after enter).

Any ideas??




RE: [flexcoders] Re: Clear user text after enter on TextInput (gumbo and/or moxie)

2009-06-15 Thread Peter DeHaan
This seems to work for the Spark TextInput control (although, you're right, I 
do see that it is removing the blinking text insertion cursor - but the 
TextInput control still has focus and allows me to type):

?xml version=1.0 encoding=utf-8?
s:Application xmlns:fx=http://ns.adobe.com/mxml/2009;
   xmlns:s=library://ns.adobe.com/flex/spark
   xmlns:mx=library://ns.adobe.com/flex/halo

fx:Script
![CDATA[
import mx.events.FlexEvent;

protected function 
ti_enterHandler(event:FlexEvent):void {

arrList.addItem({lbl:ti.text});
ti.text = ;
}
]]
/fx:Script

fx:Declarations
s:ArrayList id=arrList /
/fx:Declarations

s:VGroup x=10 y=10
s:TextInput id=ti 
enter=ti_enterHandler(event); /
mx:DataGrid id=dg dataProvider={arrList} /
/s:VGroup

/s:Application


Also, this seems to work for the Halo TextInput control. Not sure why, but 
adding a callLater() seems to make it happy.

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;

mx:Script
![CDATA[
import mx.events.FlexEvent;

protected function 
ti_enterHandler(event:FlexEvent):void {

arrColl.addItem({lbl:ti.text});

callLater(clearTI, [ti]);
}

protected function 
clearTI(target:TextInput):void {
ti.text = ;
}
]]
/mx:Script

mx:ArrayCollection id=arrColl /

mx:VBox
mx:TextInput id=ti enter=ti_enterHandler(event); /
mx:DataGrid id=dg dataProvider={arrColl} /
/mx:VBox

/mx:Application


Please feel free to file bugs for either/both issues at 
http://bugs.adobe.com/flex/.

Peter





From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of gwangdesign
Sent: Monday, June 15, 2009 1:08 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Clear user text after enter on TextInput (gumbo 
and/or moxie)





--- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
valdhor valdhorli...@... wrote:

 This works for me (I am using Flex 3.3 with Flash Player 9.0.159)

 If this is not a player or Gumbo issue, I would look at other things 
 happening after the enter event.

 What happens with a small test case?

Steve, Thanks for the lead.

As I found out, it seems to be the issue when I targeting Flash Player 10. The 
code:

myTextInput.text = ;
//myTextInput.setFocus();// no need to call this.

works exactly as I expect (clearing the previous text entry, with TextInput 
remaining in focus) for an mx:TextInput when compile against FP 9.

Once I target FP10, myTextInput.text =  stops working (text not cleared out 
after enter).

Any ideas??



[flexcoders] Re: Clear user text after enter on TextInput (gumbo and/or moxie)

2009-06-15 Thread gwangdesign

 Please feel free to file bugs for either/both issues at 
 http://bugs.adobe.com/flex/.

Hi Peter,

I filed a bug on spark textinput. Someone else has filed one on mx:TextInput 
(https://bugs.adobe.com/jira/browse/SDK-21617) and provided a workaround which 
is similar to the callLater one you suggested:

setTimeout(doClean, 100);
}
private function doClean():void
{
txt.text='';
} 

Thanks.

Geng
 




[flexcoders] Re: Clear user text after enter on TextInput (gumbo and/or moxie)

2009-06-14 Thread gwangdesign

 BTW, I am not sure if this behavior is something expected from user 
 experience point of view since I looked at Google, Yahoo! and Bing, all of 
 them did the same thing: once you pressed enter, the search textinput lost 
 focus. You would have to regain focus for the textinput to do another search.

I just found out that the RL ToDoList widget at igoogle.com does exactly the 
same thing as I wanted, except that it is AJAX...:)

http://rlwidgets.com/