Announcement

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

    SelectItem, DoubleClickHandler, clicked entry?

    smartgwt-3.0p
    SmartClient Version: v8.2p_2012-05-31/LGPL Development Only (built 2012-05-31)

    I have added a DoubleClickHandler and a ChangedHandler to a SelectItem.
    DoubleClickHandler.onDoubleClick() fires before ChangedHandler.onChanged().

    In onDoubleClick, I need the entry on which the user has clicked.

    SelectItem.getValues() returns this entry, when called from ChangedHandler.onChange, but it returns the previously selected entry (or entries) when called from DoubleClickHandler.onDoubleClick().

    DoubleClickEvent is also of no help.

    So, how can I find that entry from within onDoubleClick?
    y-Position (using the form's DoubleClickHandler/Event) is of no help as I cannot find a way to convert y to the line number (if the control has scroll bars).

    Is it possible to send an event (from within the DoubleClickHandler) that would arrive *after* onChanged? (FormItem.fireEvent arrives before onChanged)

    Thanks, AAO.
    Last edited by AloneAgainOr; 16 Aug 2012, 05:00. Reason: more findings/ideas/questions

    #2
    Problem solved, or, rather, circumvented.

    execute() from the following code snippet
    Code:
    import com.google.gwt.core.client.Scheduler;
    ...
    public void onDoubleClick(DoubleClickEvent event) {
        final SelectItem si = (SelectItem)event.getItem();
        Scheduler scheduler = Scheduler.get(); 
        scheduler.scheduleDeferred(
                new Scheduler.ScheduledCommand() {
                    public void execute() {
                        String[] selectedValues = si.getValues();
                        ...
                    }
                });
    }
    runs after onChanged() and therefore sees the current selectedValues.

    Comment

    Working...
    X