sorry, I can't write English well..


this program is addFocusEvent and removeFocusEvent.

if  toggle button is down - > removeFocusEvnet,
if  toggle button is up  -> addFocusEvent.


but when the focus is on textbox,   focusEvnet is work...

How can remove event???
(I test KeyboardListenerAdapter, but same..)

package com.rontab.pine.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.FocusListenerAdapter;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.Widget;


public class TrackerEntryPoint implements EntryPoint {


        TextBox tb = new TextBox();
        ToggleButton btn = new ToggleButton("toggle");
        FocusEvent focusEvent = new FocusEvent();
        public void onModuleLoad() {

                HorizontalPanel hPanel = new HorizontalPanel();

                hPanel.add(tb);
                tb.addFocusListener(focusEvent);
                hPanel.add(btn);

                btn.addClickListener(new ClickListener() {
                        public void onClick(Widget sender) {
                                if ( btn.isDown() ) {
                                        GWT.log("Toggle is Down", null);
                                        btn.removeFocusListener(focusEvent);


                                }else {
                                        GWT.log("Toggle is up", null);
                                        btn.addFocusListener(focusEvent);
                                }
                        }
                });

                RootPanel.get().add(hPanel);

        }

}
class FocusEvent extends FocusListenerAdapter {
        public FocusEvent(){
        }

        public void onFocus(Widget sender) {
                GWT.log("TextBox get Focus", null);
        }
        public void onLostFocus(Widget sender) {
                GWT.log("TextBox lost Focus", null);
        }
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to