:: Forum >>

A bug in Control.onmouseout() handler - or not?

If I click on a button, such as the one in the button quickref example, the Control.onmousedown() adds a aw-mousedown-button class to the button, which causes the button to be highlighted. Control.onmouseup() contains the corresponding code to clear the class/highlight when the mouse-up event is received.

My bug, if it is one, is that if I click down on the UI-button but move the mouse way from the UI-button while the mouse-button is depressed, then the UI-button remains highlighted. It would seem that Control.onmouseout() should have code similar to onmouseup() to clear the added class, i.e.:

obj.onControlMouseOut = function(event){
var e = AW.srcElement(event);
while(e) {
if (e.getAttribute && e.getAttribute("aw")){
if (e.getAttribute("aw") != "control") {
e.className = e.className.replace(/ aw-mousedown-\w+/g, "");
}
}
if (e.getAttribute && e.getAttribute("awx")){
e.className = e.className.replace(/ aw-mousedown-\w+/g, "");
}
e = e.parentNode;
}
}


Equally, Control.onmouseover() could have code similar to onmousedown(), so that when the user clicks outside of the button then moves the mouse onto the UI-button while the mouse-button is depressed. However, there seems to be no way in a mouseover event to determine whether the mouse button is down or up.
LostInSpace
Monday, December 12, 2005
This does not sound like a bug, it sounds like normal behavior. In most Windows and web applications, if you click on an object then move the mouse off of it, it will remain selected. If you let up on the mouse while you are off of the object, that objects mouseUp event does not trigger. This gives you the ability to 'chicken out' if you accidentally click on a button that you didn't mean to. It also gives you the ability to click on a slider and move it up/down left/right without having to exactly keep the mouse on the slider. If you accidentally move the mouse off the slider it doesn't stop working (at least in most applications). And if you press down on the mouse button, then move the cursor over a button then release the mouse button it should execute the mouseUp code of the button. This is all normal behavior in both Windows and web applications.
Jim Hunter
Monday, December 12, 2005
Hey Jim,

Many thanks for the reply - much appreciated.

I agree about pressing down then moving the mouse over a button. I clearly had my brain turned off by the time I got to that bit.

Not sure I agree about pressing down on the button then moving away. For example, consider the Windows XP Notepad Save As... dialog Save button. When I press down on the mouse-button, the UI-button "depresses". If I mouse-away from the button, it springs back up again. Keeping the mouse-button depressed, if I mouse back over the button again, it depresses again.

In either case, it's not a big problem. If Alex thinks this is a problem, then it won't be too hard for him to fix it. If Alex doesn't consider it a problem, then that's cool too. I know how to fix it if my customer thinks its a problem.
LostInSpace
Monday, December 12, 2005
After reviewing the sample controls page, I see that Alex has the correct mouseOver behavior on the Tab control but the button control does not seem to follow the same behavior. I too think that the button control needs to follow the same behavior as the tab control which is the same behavior as any Windows button in XP. That is, the mouseOver behavior should be independant of the current mouse button state. Right now, once you depress a button, it does not become raised again until a mouseUp event fires on the button. This can leave a button in a 'pressed' position after removing your finger from the mouse if the cursor is outside the button area.
Jim Hunter
Monday, December 12, 2005

This topic is archived.


Back to support forum

Forum search