Problem solved (but not clean).
I still have not found the true answer, but I wanted a way to show you
a trick to avoid it. It is due to the propagation of the Click-Event
and to solve it I have add "event.stopPropagation()" in the first line
of the function onClick, and it works even though not very clean.
> public void onClick(ClickEvent event) {
event.stopPropagation();
> edit();
> }
Regards,
Nono
> Hi,
>
> Could you try to addBlurEvent after setting focus to true ?
>
> Regards,
>
> 2009/6/28 Arnaud Blanchard <[email protected]>
> Hi,
>
> When I set setFocus on a object it is focussed and immediatly after,
> an onBlur event is send. I did not have this problem on 1.5 with
> focus listener. You can see the code below. "solidify" is call
> immediatly after we have time to see that the area of text has been
> selected. Maybe the onClick event haven't been destroyed ?
>
> Thank for your help,
>
> Nono
>
>
> public void edit()
> {
> this.clear();
> areaOfText = new SuggestBox(Text.suggestions);
> areaOfText.setText(text.content);
> areaOfText.addStyleDependentName(Integer.toString(level));
>
>
> /* PROBLEM HERE */
> areaOfText.getTextBox().addBlurHandler(new BlurHandler(){
> public void onBlur(BlurEvent event) {
> solidify(areaOfText.getText());
> }
> });
> this.add(areaOfText);
> areaOfText.setFocus(true);
> /* END PROBLEM */
> }
>
> public void solidify(String newContent)
> {
> if (!newContent.equals(text.content))
> {
> this.text = text.createNewText(newContent);
> this.info = this.info.createNewInfo("text", text.id);
> }
> this.clear();
> label = new Label(text.content);
> label.addStyleDependentName(Integer.toString(level));
>
> /* MAYBE PROBLEM HERE */
> label.addClickHandler(new ClickHandler(){
> public void onClick(ClickEvent event) {
> edit();
> }
> });
> this.add(label);
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---