View Full Version : [1.0a2 Rev 5] Buttons issue ("pressed" state)

27 Feb 2007, 9:54 PM
Dialog buttons (or may be all buttons) issue.
Try to move mouse curdor on button, press mouse button, don't release it, remove mouse cursor from button and release mouse button. Button remains "pressed".
I think, it can be fixed by adding
this.el.removeClass("x-btn-click");to Button.onMouseOut()

27 Feb 2007, 11:20 PM
It's a little more complicated than that. If you move the pressed mouse off a genuine, windows button, you'll see that it does become "undepressed" as you say. Move the mouse back over it, and it redepresses. If after mousing off it you release the mouse, then mousing back over does not "redepress" it.

I noticed this a while ago, but didn't want to bother Jack with it.

You'll see the logic required if you look at the ClickRepeater class. Jack should be able to drop it into Ext.Button

The logic is:

On mousedown, you do add the mouseout listener to remove the "pressed" class as you say.

But, also on mousedown, after adding the "pressed" class, you have to add a mouseover listener to re-add the class if you move the mouse back over without releasing the button (re-entry).

The mousedown handler also has to add a document mouseup listener which clears pressed state, and removes the mouseover "re-entry" handler.

28 Feb 2007, 1:41 AM
Animal, thanks for detailed answer ;)

28 Feb 2007, 9:33 AM
This has been an issue for a while and is low priority. I wil lfix it before the official release. The temporary solution: don't try to drag buttons because they are not draggable. :shock:

28 Feb 2007, 12:08 PM
But a button click should be cancellable without actually clicking :) Yes, definitely low priority.