/    Sign up×
Community /Pin to ProfileBookmark

Cursor won’t change until mouse moves

I’ve been trying to get the cursor (in IE5.5) to change to an hourglass and then back to the default after a long process.

The method below is called with cursorType = “wait” on the pressing of a button – at the same time an asynchronous call is made to a 3rd party ActiveX COM object to start the process (which is a call to a remote computer). When the process is complete, the ActiveXControl calls a JavaScript event handler which in turn calls setCursor with cursorType = “default”.

This sort of works, but the change from hourglass back to the default arrow doesn’t become visible until the user moves the mouse. This rather defeats the point of the hourglass. The user is patiently staring at the screen waiting for it to change back to the default pointer… Little do they know that the process has finished but the cursor won’t change until they nudge the mouse!

Any ideas?

[code]
function setCursor(cursorType) {
if (document.all) {
for (var i=0; i < document.all.length; i++) {
document.all(i).style.cursor = cursorType;
}
}
}
[/code]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Dec 16.2002 — if you are calling this method at "onload" event,it should respond as desired,re evaluate your code...

:-)

Khalid
Copy linkTweet thisAlerts:
@tafftasticDec 16.2002 — It may be worth trying to blur the window and then focus it again when the activeX makes it's javascript call:

Someting like-

window.blur();

window.fucus();

This can sometimes have the same effect as moving the mouse, failing that try to focus on the "next" button or whatever it is that you want the user to do next:

document.forms.myForm.nextButton.focus()

Hope tis helps
Copy linkTweet thisAlerts:
@jon_stewartauthorDec 16.2002 — Thanks for your posts. The suggestion from tafftastic to blur and refocus after changing the cursor does the job nicely.

setCursor("default"); //Function defined in original post

window.blur();

window.focus();

(This is only necessary on events not generated from the document - button and other document work fine without the blurring and refocussing.)
×

Success!

Help @jon_stewart spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...