Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to change the MousePointer while sorting a table

Reply
Thread Tools

How to change the MousePointer while sorting a table

 
 
Stefan Mueller
Guest
Posts: n/a
 
      01-24-2006
With
document.body.style.cursor = "wait";
I can set the hourglass and with
document.body.style.cursor = "default";
I can set the MousePointer back. That works great.

But if I do
document.body.style.cursor = "wait";
<sort the table>
document.body.style.cursor = "default";
I never see the MousePointer as a hourglass. I guess the problem is that the
MousePointer is only updated at the end of the javascript function.
Is there something like a refresh?

Stefan


 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      01-25-2006

Stefan Mueller wrote:
> With
> document.body.style.cursor = "wait";
> I can set the hourglass and with
> document.body.style.cursor = "default";
> I can set the MousePointer back. That works great.
>
> But if I do
> document.body.style.cursor = "wait";
> <sort the table>
> document.body.style.cursor = "default";
> I never see the MousePointer as a hourglass. I guess the problem is that the
> MousePointer is only updated at the end of the javascript function.
> Is there something like a refresh?


You have to let your document a micro-break for updates:

document.body.style.cursor = "wait";
setTimeout(mySortFunction);

function mySortFunction() {
....
....
document.body.style.cursor = "default";
}

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      01-25-2006
VK wrote:

> You have to let your document a micro-break for updates:
>
> document.body.style.cursor = "wait";
> setTimeout(mySortFunction);


Since when is the second argument of setTimeout() an optional one?
And using a function reference will indeed _break_ or not work in
older UAs, especially older IEs.

> function mySortFunction() {
> ...
> ...
> document.body.style.cursor = "default";
> }



PointedEars
 
Reply With Quote
 
VK
Guest
Posts: n/a
 
      01-25-2006

Thomas 'PointedEars' Lahn wrote:
> Since when is the second argument of setTimeout() an optional one?


Since always. It ensures the minumum time period available at the given
system (1 system tick) w/o needs to worry about the particualr system
type (Win98 ... Win XP, Mac, Linux)

> And using a function reference will indeed _break_ or not work in
> older UAs, especially older IEs.


The oldest IE still officially supported by Microsoft (and available
for download) is IE 5.5 SP2 for Windows. Any older IE's (as well as
IE's for Mac) are out of practical interest for anyone including
myself. It doesn't prevent personal proprietary choices (like you are
welcome to make NN 3.0 Gold - compliant solutions) but it is not a
subject of public consideration.

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      01-25-2006
VK wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Since when is the second argument of setTimeout() an optional one?

>
> Since always. It ensures the minumum time period available at the given
> system (1 system tick) w/o needs to worry about the particualr system
> type (Win98 ... Win XP, Mac, Linux)


Neither Netscape, which invented this method, nor Microsoft or the Mozilla
Organization and other implementors which copied the implementation, agree
with you:

<URL:http://e-pla.net/documents/manuals/javascript-1.0/ref_s-s.html#setTimeout_method>
<URL:http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_s-s.htm#73328>
<URL:http://research.nihonsoft.org/javascript/jsref/win1.htm#1012029>
<URL:http://research.nihonsoft.org/javascript/ClientReferenceJS13/window.html#1203758>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/settimeout.asp>
<URL:http://developer.mozilla.org/en/docs/DOM:window.setTimeout>
<URL:http://developer.kde.org/documentation/library/3.4-api/khtml/html/classKJS_1_1ScheduledAction.html>
<URL:http://webcvs.kde.org/khtmltests/ecma/settimeout.html?rev=1.2&view=auto>

>> And using a function reference will indeed _break_ or not work in
>> older UAs, especially older IEs.

>
> The oldest IE still officially supported by Microsoft (and available
> for download) is IE 5.5 SP2 for Windows.


Nevertheless my grandmother can use her Windows 98 SE with built-in IE 5.01
quite well. You do not want to force her (and the numerous other people
who do not want or cannot upgrade) to upgrade, do you?

> Any older IE's (as well as IE's for Mac) are out of practical
> interest for anyone including myself.


So you do not want my grandmother (and numerous other people that do not
want to or cannot upgrade) to buy stuff provided by you or your clients?
You deliberately want to decrease the profit margin for you or your
clients? Maybe there is something about selling you did not understand
properly yet.

> It doesn't prevent personal proprietary choices (like you are
> welcome to make NN 3.0 Gold - compliant solutions) but it is
> not a subject of public consideration.


Not for incompetent people like you, that is for sure.


PointedEars
 
Reply With Quote
 
Stefan Mueller
Guest
Posts: n/a
 
      01-25-2006
First of all thanks a lot for your solution. Until now it's still the only
solution I have and if it works then setTimeout is okay for me. But it
doesn't really work yet.

<html>
<body>
<script type = 'text/javascript'>
/*-------------------------------------------*/
function sorttable(var_text, var_number) {
document.body.style.cursor = "wait";
window.setTimeout("do_sorttable()", 1);
// window.setTimeout("do_sorttable(var_text, var_number)", 1);
}
/*-------------------------------------------*/
function do_sorttable() {
// function do_sorttable(var_text, var_number) {
for (i = 1; i < 2000000; i++) {
}

alert("Done.");
document.body.style.cursor = "default";
}
</script>

<input type = 'checkbox' name = 'my_ckeckbox' onClick =
'sorttable("abc", 123)'>
In Mozilla and Opera the MousePointer is only on this text an
hourglass and in Mozilla only after the alert box. Why that and how can I
solve that problem?
</body>
</html>


In Mozilla and Opera the MousePointer is not on the whole window an
hourglass and in Mozilla only after the alert box. Why that and how can I
solve that problem?

My second problem is that if I use
window.setTimeout("do_sorttable(var_text, var_number)", 1);
and
function do_sorttable(var_text, var_number) {
it doesn't work at all (Error: 'var_text' is undefined.

Stefan


 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      01-25-2006
Thomas 'PointedEars' Lahn posted the following on 1/25/2006 11:14 AM:
> VK wrote:


<snip>

>>> And using a function reference will indeed _break_ or not work in
>>> older UAs, especially older IEs.

>> The oldest IE still officially supported by Microsoft (and available
>> for download) is IE 5.5 SP2 for Windows.

>
> Nevertheless my grandmother can use her Windows 98 SE with built-in IE 5.01
> quite well. You do not want to force her (and the numerous other people
> who do not want or cannot upgrade) to upgrade, do you?


The same argument could be used for NN4 users then but I don't see you
professing to want to support NN4 though. Somewhere, you have to draw
the line on how far back you want to support a family of browsers.
Personally, IE5.5 is too old to be considered current and should be
dropped. IE5.0 goes without saying.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to change the overall mousepointer? Stefan Mueller Javascript 12 12-16-2009 03:46 AM
Can I change the mousepointer while hovering over datagrid? jef ASP .Net Datagrid Control 1 04-12-2005 10:57 AM
Re: Changing MousePointer Steve C. Orr [MVP, MCSD] ASP .Net 0 07-20-2004 11:27 PM
mousepointer in webform =?Utf-8?B?SW1yYW4=?= ASP .Net 2 03-06-2004 02:06 PM



Advertisments