473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mouse won't change (onmousedown="t his.style.curso r='different'")

I have set onmousedown to change the cursor, but this setting is ignored
(IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the
mouse button is released. On Opera 7.01, the setting seems to be ignored
completely, even when I try with window.setTimeo ut.

So my two questions are: (1) Most important: Is there anything I can do
so that I don't have to wait for the next mouse event before the cursor
gets repainted. (2) Why is this not working for Opera at all?

The page below can also be found at http://csaba.org/demos/revert.htm

Things I have tried include window.setTimeo ut for the cursor change,
putting in a <STYLE> section and trying to change the cursor by means
of changing the class, faking a mouse event by putting in a fireEvent to
simulate a mouseMove. Same behaviour as above for all attempts.

This problem also happens on the other side. That is, in a situation
where I have changed the mouse cursor on the down click (subsequently
to moving the mouse) and then I want to revert it on a onmouseup, I
should move the mouse before the cursor changes. That's not nice.

Thanks for any tips,
Csaba Gabor from New York
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="content-type" content="text/html;charset=is o-8859-1">
<TITLE>Cursor changing demo</TITLE>
</HEAD>
<BODY bgcolor=gold style="margin-left:5%;margin-top:10%">
<DIV style="border:b lue 1px solid"
onmouseout="thi s.style.cursor= 'auto'"
onmouseover="th is.style.cursor ='se-resize'"
onmousedown="th is.style.cursor ='move'">Click and drag</DIV>
<BR><BR><BR>
If you move the mouse over the DIV then its type should change to 'se-resize'.
<BR><BR>
If you now click (and hold) without moving the mouse,
the cursor should change to a 'move' type.
In Opera 7.01 the cursor type does not change at all.

In both IE 5.5 and Netscape 6.1 I either have to release
the mouse button, or move it (with the button still
clicked) in order to get the cursor to change. This does
not seem reasonable.
</BODY>
</HTML>

Jul 20 '05 #1
3 17292
Ahem,

I have figured outsomething for IE and Netscape.
It's not a particularly nice solution (because it represents a large
computational overhead for the browser), but so far on my
smaller test cases it seems to be working on still mouse down
events (without mouse movement).

Replace the onmousedown line as follows:
onmousedown="th is.style.cursor ='move';window. resizeBy(1,0);w indow.resizeBy(-1,0)"

Sadly, it has not made a difference for Opera.
In Netscape 6+, the overhead of the two window.resizeBy calls may be bypassed
by using, instead, window.setCurso r('move')

Csaba

"Csaba2000" <ne**@CsabaGabo r.com> wrote in message news:bj******** @dispatch.conce ntric.net...
I have set onmousedown to change the cursor, but this setting is ignored
(IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the
mouse button is released. On Opera 7.01, the setting seems to be ignored
completely, even when I try with window.setTimeo ut.

So my two questions are: (1) Most important: Is there anything I can do
so that I don't have to wait for the next mouse event before the cursor
gets repainted. (2) Why is this not working for Opera at all?

The page below can also be found at http://csaba.org/demos/revert.htm

Things I have tried include window.setTimeo ut for the cursor change,
putting in a <STYLE> section and trying to change the cursor by means
of changing the class, faking a mouse event by putting in a fireEvent to
simulate a mouseMove. Same behaviour as above for all attempts.

This problem also happens on the other side. That is, in a situation
where I have changed the mouse cursor on the down click (subsequently
to moving the mouse) and then I want to revert it on a onmouseup, I
should move the mouse before the cursor changes. That's not nice.

Thanks for any tips,
Csaba Gabor from New York
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="content-type" content="text/html;charset=is o-8859-1">
<TITLE>Cursor changing demo</TITLE>
</HEAD>
<BODY bgcolor=gold style="margin-left:5%;margin-top:10%">
<DIV style="border:b lue 1px solid"
onmouseout="thi s.style.cursor= 'auto'"
onmouseover="th is.style.cursor ='se-resize'"
onmousedown="th is.style.cursor ='move'">Click and drag</DIV>
<BR><BR><BR>
If you move the mouse over the DIV then its type should change to 'se-resize'.
<BR><BR>
If you now click (and hold) without moving the mouse,
the cursor should change to a 'move' type.
In Opera 7.01 the cursor type does not change at all.

In both IE 5.5 and Netscape 6.1 I either have to release
the mouse button, or move it (with the button still
clicked) in order to get the cursor to change. This does
not seem reasonable.
</BODY>
</HTML>

Jul 20 '05 #2
"Csaba2000" <ne**@CsabaGabo r.com> wrote in message
news:bj******** @dispatch.conce ntric.net...
I have figured outsomething for IE and Netscape.
It's not a particularly nice solution (because it represents a large
computationa l overhead for the browser), but so far on my
smaller test cases it seems to be working on still mouse down
events (without mouse movement).

Replace the onmousedown line as follows:
onmousedown="t his.style.curso r='move';
window.resizeB y(1,0);window.r esizeBy(-1,0)"
Yuk! I haven't tried it but if the problem is getting IE to redraw the
cursor you might find that toggling the visibility property of the
element that the mouse is over is sufficient. Better than re-sizing the
entire window anyway (would that even work if the user has set F11
(fullscreen)?), as none of the rest of the page would need to be touched
but it should catch the cursor (It might take a timeout on the
re-showing to actually get the re-draw). But there has got to be a
better way, unfortunately I don't have time to look (and won't for at
least another couple of days).
Sadly, it has not made a difference for Opera.
In Netscape 6+, the overhead of the two window.resizeBy
calls may be bypassed by using, instead,
window.setCurs or('move')


So:-

if(window.setCu rsor){
window.setCurso r('move');
}else{
. . . //horrible IE hack
}

Richard.
Jul 20 '05 #3
Hurrah Richard!

Good to hear from you.

"Richard Cornford" <ri*****@litote s.demon.co.uk> wrote in message news:bj******** **@hercules.bti nternet.com...
"Csaba2000" <ne**@CsabaGabo r.com> wrote in message
news:bj******** @dispatch.conce ntric.net...
I have figured outsomething for IE and Netscape.
It's not a particularly nice solution (because it represents a large
computationa l overhead for the browser), but so far on my
smaller test cases it seems to be working on still mouse down
events (without mouse movement).

Replace the onmousedown line as follows:
onmousedown="t his.style.curso r='move';
window.resizeB y(1,0);window.r esizeBy(-1,0)"
Yuk! I haven't tried it but if the problem is getting IE to redraw the


I agree with both your sentiment and logic. But, after some
investigation, I was not able to get the .style.visibili ty to work
(which, on reflection, makes sense, since only a local portion of
the page should be redrawn. Though it would also make
sense for this problem not to exist in the first place). In particular,
if I put in a one second delay for making the (target) object visible
again and jiggle the mouse while the target object is hidden, the
mouse reverts to a pointer (which, I'm presuming, is the cursor
type of the underlying element (the body)) from whatever I had
assigned in the onmouseover, and stays that way till I either move
the mouse or release the button.

I didn't try it with .style.display since I figured that was tantamount
to recomputing the entire page, like with resizing.

Interestingly, I also tried making both Netscape and IE full screen,
and the double .resizeBy worked even better since there wasn't
any flicker this time, but the cursor did refresh. Go figure.

If you wind up finding an improvement, and by all rights there
should be one, I would love to hear about it.

Regards from New York,
Csaba
cursor you might find that toggling the visibility property of the
element that the mouse is over is sufficient. Better than re-sizing the
entire window anyway (would that even work if the user has set F11
(fullscreen)?), as none of the rest of the page would need to be touched
but it should catch the cursor (It might take a timeout on the
re-showing to actually get the re-draw). But there has got to be a
better way, unfortunately I don't have time to look (and won't for at
least another couple of days).
Sadly, it has not made a difference for Opera.
In Netscape 6+, the overhead of the two window.resizeBy
calls may be bypassed by using, instead,
window.setCurs or('move')


So:-

if(window.setCu rsor){
window.setCurso r('move');
}else{
. . . //horrible IE hack
}

Richard.

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
22728
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The following are the problems and I hope that there is someone who can enlighten me or give me some pointers. Also, my testing code is attached at...
5
5191
by: chad.a.morris | last post by:
Hi everyone, I didn't know how to sum this up very well for the title, but hopefully the person(s) will come along who can help. I'm trying to use the window.event.clientX value for positioning a javascript routine, but I'm having trouble. When the javascript routine comes up, it comes up in a certain position based on...
8
12651
by: NeoAsimov | last post by:
Hello, There is what I want to do. I worked on the problem since 6 hours but I had a problem (probably stupid) and I dont know how to resolve it. I need to have an Mouse Event Click when I click on the frame of a window form ( like the title bar of a window).
6
10809
by: Carlos García-Carazo | last post by:
Hello, I am working on a C# application for an industrial machine, using Windows Forms, where the user could look at the screen from a 90 degree rotated position, like he could turn the monitor to leave it standing on its left (or right) side. There are many ways to show a "turned" interface in this case, but the problem is that when he...
2
2596
by: Ryan Liu | last post by:
Hi, I need the MouseDown event be trigged everytime when you press mouse in a datagrid (System.Windows.Forms). But seems mouse event will only fire once, and it seems changed to edit mode for the cell (even the cell is read). The mouse event won't fire again until I click on some other cell and come back and click on the original...
1
1584
by: Ryan Liu | last post by:
Hi, I need the MouseDown event be trigged everytime when you press mouse in a datagrid (System.Windows.Forms). Hi, I need the MouseDown event be trigged everytime when press mouse in a datagrid (System.Windows.Forms).
2
2854
by: Rudiga | last post by:
Hi, Is there any kind of mouse over type method in C#, that will change the mouse to a different pointer when the mouse is over a picture box. The reason i as is that i am intending to use a picture instead of a button to move to another form and its not obvious, without writing on the user interface, what to do. I thought a change in mouse...
6
9706
by: marss | last post by:
Hi, How can I define in Firefox whether the left mouse button is pressed when I move mouse over a html element? The documentation says that "e.button == 0 for standard 'click', usually left button" http://developer.mozilla.org/en/docs/DOM:event.button Tracing of mouse clicks or mousedown/mouseup events looks not reliable, because mouse can...
2
6945
by: wpollans | last post by:
Hello, I need to able to write JS that will click on a link with the middle mouse button - so that the link target will open in a new window or tab - using firefox. Or is there a better (more reliable) way to have the link open in a new window/tab (using JS)? I have no control over the JS already on the page - this is for a selenium user...
0
7711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7628
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6317
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3679
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2128
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1236
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.