Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    BlurHandler and DateItem

    Greetings!

    On my DynamicForm I have one DateItem with setUseTextField(true). I added BlurHandler to it and my question is if I can somehow know in that BlurHandler, that picker icon of that same DateItem was clicked?
    Or in another words: I don't want BlurHandler to fire if I just open date picker to select another date.
    Is this possible?

    Code:
        @Override
        public void onModuleLoad() {
            DynamicForm form = new DynamicForm();
    
            DateItem dateItem = new DateItem("toDate", "TO DATE");
            dateItem.setUseTextField(true);
            dateItem.setShowPickerIcon(true);
            dateItem.addBlurHandler(new BlurHandler() {
                
                @Override
                public void onBlur(BlurEvent event) {
                    // how to avoid this when picker icon is pressed
                    System.out.println("I'm in BlurHandler");
                }
            });
            
            TextItem textItem = new TextItem("anotherField", "ANOTHER FIELD");
            
            form.setItems(dateItem, textItem);
    
            com.smartgwt.client.widgets.Window window = new com.smartgwt.client.widgets.Window();
            window.setWidth(500);
            window.setHeight(300);
            window.setAutoCenter(true);
            window.setIsModal(true);
            window.addItem(form);
            window.show();
            
            FormItemIcon icon = dateItem.getIcon("picker");
            if (icon != null) {
                icon.setTabIndex(-1);
            } else {
                System.out.println("no picker");
            }
        }
    I'm using :
    SmartClient Version: 8.2/LGPL Development Only (built 2011-12-05)
    Firefox 3.6.28
    Chrome 19.0.1084.46 m

    Thanks,
    Zoran
    Last edited by zoranl; 24 May 2012, 01:35. Reason: added code sample
Working...
X