-
8 Dec 2010 9:32 AM #1
Problem with Slider and Events.OnMouseUp
Problem with Slider and Events.OnMouseUp
I am trying to have the value of the slider only when the mouse is release, this event is fired if I click and release the slider bar itself but not when I drag and release the slider cursor.
I am using google Chrome as a browser and gxt 2.2.0Code:Slider pageSlider = new Slider(); pageSlider.addListener(Events.OnMouseUp, new Listener<SliderEvent>() { @Override public void handleEvent(SliderEvent be) { //do stuff... } });
-
8 Dec 2010 9:45 AM #2
Why do you think this is a bug? If themouse up happens outside of the component, than this code would not get it, because you only listen to the mouseup within the component.
You need to use native event preview for example.
-
8 Dec 2010 9:52 AM #3
It doesn't happen in both cases (inside or outside the slider) so I figured it might be a bug, sorry for the confusion anyway. But it doesn't catch the OnMouseUp when you use the slider control, but it does when you use the slider bar
-
8 Dec 2010 9:59 AM #4
I would use a completly different approach.
1) You can use the change event with a Timer. If the Change event fires two times within a given amount of time, cancel the timer and reschedule it.
2) Extend Slider and override onDragEnd and add your custom logic.
-
8 Dec 2010 10:04 AM #5
That was exactly what I was trying to do ( solution 1 ) by adding this inside the handleEvent
Code:DelayedTask delay = new DelayedTask(this); delay.delay(1000);
-
8 Dec 2010 10:06 AM #6
This would always recreate the task, meaning you have it still fire all the time, just one second later. You need to cancel the previes one (do not revreate DelayedTask)
-
8 Dec 2010 10:46 AM #7
It's funny but it seems impossible to create the delayTask outside the listener (it needs a listener to create it, and not null one). Do you have any tips for how to create this delayTask please?
-
8 Dec 2010 4:22 PM #8
Code:slider.addListener(Events.Change, new Listener<SliderEvent>() { DelayedTask t = new DelayedTask(new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { System.out.println("test"); } }); public void handleEvent(SliderEvent be) { t.delay(1000); } });
-
9 Dec 2010 7:42 AM #9
-
9 Dec 2010 8:06 AM #10
I also have just one question if you don't mind:
What the difference between events that start with "on" like "Events.onChange" and the events that are without like "Events.Change"?
Similar Threads
-
[3.2] Ext.ux.slider.Highlight - A slider background color plugin
By mankz in forum Ext 3.x: User Extensions and PluginsReplies: 8Last Post: 8 Feb 2012, 5:03 AM -
[OPEN-979] Ext.form.SliderField -> Slider events
By tobiu in forum Ext 3.x: BugsReplies: 6Last Post: 30 Mar 2011, 2:58 AM -
[DEFER-1207] Slider in panel with collapsed:true make slider weird
By mitch_feaster in forum Ext 3.x: BugsReplies: 2Last Post: 19 Sep 2010, 11:48 PM -
How to change the scope of 'this' object in the Ext.Resizable.dd.onMouseUp event ?
By disizben in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 21 Nov 2007, 6:17 AM


Reply With Quote