473,395 Members | 1,986 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Timing Mouse Pointer changes

I have a page that, when invoked, it runs a while (~ 15 seconds), then
displays a DataGrid control. What I want to accomplish is to have the mouse
pointer go to 'wait', then after the control displays, return to 'default'.

What happens is the SetWaitPointer() routine changes the cursor to 'wait',
but before the data grid is displayed on the page, 'SetDefaultPointer()'
runs and changes the cursor back to 'default'. This happens about 3 seconds
in, so the user spends 12 seconds looking at a blank window and a default
mouse pointer. I'm imagining that's when he will get that uneasy "Don't
leave me hanging, Dawg" feeling.

I have included a simplified version of the code I use for this. Can anyone
point me to a solution to this? How can I make sure that
SetDefaultPointer() won't fire until the control displays?

Thanks,

Dave

'The platform is Visual Studio 2003, in-line VB.NET
'The functions SetWaitPointer() & SetDefaultPointer() are basically
javascript:
dim sCommand as string = "document.body.style.cursor = 'wait'; "
response.write("<script language=JavaScript>" & sCommand & "<" &
"/script>")

Sub Page_Load(Sender As Object, E As EventArgs)

SetWaitPointer()

DisplayDatabaseGrid()

SetDefaultPointer()

End Sub
Nov 21 '05 #1
15 1496
Dave,

I have not direct the solution because I did a while no JavaScript,

However what you are doing is when I see it right.

Set on the serverside the Wait Cursor (this has no effect on your
clientside)
Initialize
Set on the serverside the default Cursor

Sent the page.

I cannot believe that that is what you want.

Probably you want to set the cursor before the postback from the client to
the server and set it to default when the page is again received on the
client.

As I said I have no snippet for it at hand, maybe somebody else.

Cor
Nov 21 '05 #2
Hello, Cor.

The key phrase of yours is "when the page is again received on the client".

I am somewhat of a newbie in web developement. I do not know how to
determine this event. Just playing around, I took the SetDefaultCursor()
out of my code, enclosed it in "<%....%>", and stuck it near the bottom of
all the html code. That worked fine, except that it unexpectedly made the
routine run for 62 seconds instead of 15 seconds.

Anyway, if you know what I should look at to determine when the page is
received by the client, I would appreciate it.

Thanks again,

Dave
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl...
Dave,

I have not direct the solution because I did a while no JavaScript,

However what you are doing is when I see it right.

Set on the serverside the Wait Cursor (this has no effect on your
clientside)
Initialize
Set on the serverside the default Cursor

Sent the page.

I cannot believe that that is what you want.

Probably you want to set the cursor before the postback from the client to
the server and set it to default when the page is again received on the
client.

As I said I have no snippet for it at hand, maybe somebody else.

Cor

Nov 21 '05 #3
Dave,

Quickly I found this, maybe I look tomorrow, however no promish

Button1.Attributes("onclick") = "document.body.style.cursor='wait'"

However it shows only the wait status there where there are no controls, I
think that I know now how to do it, however I have no time to write that
now.

Cor
Nov 21 '05 #4
Thank you, Cor. I have used this method (Button1.Attributes.....) in the
past, but I don't know how to make it work for my present problem.

If I am reading between the lines correctly, you may have a solution
forthcoming. If so, I am patient - I can wait.

I think there is probably some trappable event, but I don't know what it
would be. I know the page knows - because the cursor changes to 'Working in
Background' when you touch the browser's border with the cursor.

Thanks again,

Dave

"Cor Ligthert" <no************@planet.nl> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Dave,

Quickly I found this, maybe I look tomorrow, however no promish

Button1.Attributes("onclick") = "document.body.style.cursor='wait'"

However it shows only the wait status there where there are no controls, I
think that I know now how to do it, however I have no time to write that
now.

Cor

Nov 21 '05 #5
Dave,

In my opinion does this one what you ask.
\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes("onclick") = _
"for (var i=0;i < document.all.length; i++)
document.all(i).style.cursor = 'wait';"
Dim str As String
End Sub
///
I hope this helps a little bit?

Cor

Nov 21 '05 #6
Well, thank you Cor, but that doesn't do it. I want this to happen without
button clicks.

Someday, I'll either get better at this and figure it out, or I'll browse
onto a page that does it, and maybe by viewing the code or asking the
author, I'll get it.

I appreciate you taking time out for this little problem of mine.

Dave

"Cor Ligthert" <no************@planet.nl> wrote in message
news:OH**************@TK2MSFTNGP12.phx.gbl...
Dave,

In my opinion does this one what you ask.
\\\
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes("onclick") = _
"for (var i=0;i < document.all.length; i++)
document.all(i).style.cursor = 'wait';"
Dim str As String
End Sub
///
I hope this helps a little bit?

Cor

Nov 21 '05 #7
Dave,

What is than the action that does the return?

Cor
Nov 21 '05 #8
Cor,

This is what I think happens:

First My code. All is in Page_Load(), and all should happen automatically -
the page's only purpose is to hold and display the data grid.

1) Set Cursor Wait
2) Run a 15 second procedure
3) Set Cursor Default

What happens is while the user is waiting for step 2 to complete, step 3
kicks in after only 3 seconds, and the cursor goes back to default for 12
seconds, then the data grid displays.

I think the reason for this is that the actual 15 second procedure takes 3
seconds for the database operation, and it takes the browser 12 seconds to
process the information it gets from the server. But since the server is
done, it sends the reset cursor statement prematurely. If there was some
way I could capture when the browser actually rendered the data grid, I
think I would have it. But I don't know enough client-server programming to
do that. Someday I will ....

Thanks,
Dave

"Cor Ligthert" <no************@planet.nl> wrote in message
news:OP****************@TK2MSFTNGP15.phx.gbl...
Dave,

What is than the action that does the return?

Cor

Nov 21 '05 #9
Dave,

Did you include the code I have in the previous message.
In that is not a setting to default.

In my test it did work.

\\\needs only a button on a form
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes("onclick") = _
"for (var i=0;i < document.all.length; i++)" & _
" document.all(i).style.cursor = 'wait';"
Dim str As String
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Threading.Thread.Sleep(15000)
End Sub
///

Cor
Nov 21 '05 #10
Cor,

I thank you very much for trying to help me, but it just isn't going to
work, given my current level of understanding. For right now, I have to
move on to other things.

Once I do get it (weeks, months, or years from now), I will drop you a line
and let you know how. As you are a frequent contributor to this group, I'm
sure it will be easy to find you.

Thanks again,

Dave
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OZ**************@TK2MSFTNGP12.phx.gbl...
Dave,

Did you include the code I have in the previous message.
In that is not a setting to default.

In my test it did work.

\\\needs only a button on a form
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes("onclick") = _
"for (var i=0;i < document.all.length; i++)" & _
" document.all(i).style.cursor = 'wait';"
Dim str As String
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Threading.Thread.Sleep(15000)
End Sub
///

Cor

Nov 21 '05 #11
Cor,

Are you still monitoring this thread?

If so, I have thought of a much simpler way of framing my question.

My .aspx page has only one control on it - a database grid. When this page
opens, Page_Load() invokes a long-running procedure. How can I make it so
that when the window icon in in the upper right hand corner is waving, the
screen has a 'Wait' cursor, and after the icon stops waving, the cursor
changes to 'Default'.

Thanks,
Dave
Nov 21 '05 #12
Dave,

At least I understood where the problem was when you wrote I have alone a
datagrid on my page.

Put this in the load event.
I tried it. When it does not work for you than reply, than I show tomorrow a
complete sample where it is working with only a datagrid and a select
command in that.

\\\
Dim scriptString As String = _
"javascript:{for (var i=0;i < document.all.length; i++)
document.all(i).style.cursor = 'wait';}"
RegisterOnSubmitStatement("submit", scriptString)
///

I hope this helps a little bit?

Cor
Nov 21 '05 #13
Okay, Cor, I did put that code in, but it had no effect.

I don't know why it would have an effect since there is no submit button on
the form, or any other control (that I am aware of) that would submit.

I will look forward to seeing your sample with datagrid and select command.

Thanks again,
Dave

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uT****************@TK2MSFTNGP14.phx.gbl...
Dave,

At least I understood where the problem was when you wrote I have alone a
datagrid on my page.

Put this in the load event.
I tried it. When it does not work for you than reply, than I show tomorrow a complete sample where it is working with only a datagrid and a select
command in that.

\\\
Dim scriptString As String = _
"javascript:{for (var i=0;i < document.all.length; i++)
document.all(i).style.cursor = 'wait';}"
RegisterOnSubmitStatement("submit", scriptString)
///

I hope this helps a little bit?

Cor

Nov 21 '05 #14

I don't know why it would have an effect since there is no submit button
on
the form, or any other control (that I am aware of) that would submit.

I will look forward to seeing your sample with datagrid and select
command.

\\\This in the body of the HTML (aspx) page
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 140px"
runat="server" Width="484px">
<Columns>
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
CommandName="Select "></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</form>
<script>
</body>
///
\\\This in the code
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim scriptString As String = _
"javascript:{for (var i=0;i < document.all.length; i++)
document.all(i).style.cursor = 'wait';}"
RegisterOnSubmitStatement("submit", scriptString)
If Not IsPostBack Then
builddata()
DataGrid1.DataBind()
Else
DataGrid1.DataSource = Session.Item("dt")
End If
End Sub
Private Sub builddata()
Dim dt As New DataTable
dt.Columns.Add("Column1")
For i As Integer = 0 To 9
dt.LoadDataRow(New Object() {i.ToString}, True)
Next
Session.Item("dt") = dt
DataGrid1.DataSource = dt
End Sub
Private Sub DataGrid1_ItemCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) _
Handles DataGrid1.ItemCommand
DataGrid1.EditItemIndex = e.Item.ItemIndex
Threading.Thread.Sleep(5000)
DataGrid1.DataBind()
End Sub
End Class
///

When you push on the select the waitcursor is showed untill it is back. (I
have a set a sleep in it, to let it take some time)

Cor
Nov 21 '05 #15
Cor, thank you very much for all your help.

I loaded up your code into a new project, and it works perfectly.

Now I just need to figure out how to use it in an inline (not code-behind),
buttonless environment, and I'll be set.

Thanks again.
Dave

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...

I don't know why it would have an effect since there is no submit button
on
the form, or any other control (that I am aware of) that would submit.

I will look forward to seeing your sample with datagrid and select
command.

\\\This in the body of the HTML (aspx) page
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 140px"
runat="server" Width="484px">
<Columns>
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
CommandName="Select "></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</form>
<script>
</body>
///
\\\This in the code
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim scriptString As String = _
"javascript:{for (var i=0;i < document.all.length; i++)
document.all(i).style.cursor = 'wait';}"
RegisterOnSubmitStatement("submit", scriptString)
If Not IsPostBack Then
builddata()
DataGrid1.DataBind()
Else
DataGrid1.DataSource = Session.Item("dt")
End If
End Sub
Private Sub builddata()
Dim dt As New DataTable
dt.Columns.Add("Column1")
For i As Integer = 0 To 9
dt.LoadDataRow(New Object() {i.ToString}, True)
Next
Session.Item("dt") = dt
DataGrid1.DataSource = dt
End Sub
Private Sub DataGrid1_ItemCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) _
Handles DataGrid1.ItemCommand
DataGrid1.EditItemIndex = e.Item.ItemIndex
Threading.Thread.Sleep(5000)
DataGrid1.DataBind()
End Sub
End Class
///

When you push on the select the waitcursor is showed untill it is back. (I
have a set a sleep in it, to let it take some time)

Cor

Nov 21 '05 #16

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

Similar topics

4
by: Videos 4 Sale | last post by:
Would you know how to change the look of a mouse pointer on a web page. On the page I have the mouse pointer is exactly as I have at work.... white. But what I want to do is change the look of it...
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
9
by: DotNetShadow | last post by:
Hi Guys, I have been having this problem recently where I have a form with a textbox and button, if in the button event I have the following: Private Sub Button1_Click(ByVal sender As...
1
by: Stefan Mueller | last post by:
With the following code I can change the mouse pointer. However, if you click in Mozilla (with IE it works perfect) on 'Show hourglass' the mouse pointer changes only if you move the mouse at least...
0
by: ManConfusedByMouse | last post by:
Hi all, I AM HAVING PROBLEMS UNDERSTANDING THE UPDATING BEHAVIOR/TIMING OF A WINDOWS.FORMS.SCROLLBAR COMPONENT... quick apology for my sorry posterior if posting in wrong place -- haven't much...
2
by: diatom | last post by:
Hello, I have a custom dialog. When the user hits the 'Ok' button, I want my mouse to turn into an hourglass while its performing work - and then I want it to go back to normal afer the work is...
1
by: Narcolessico | last post by:
Hi, I'm writing on Linux an application which needs to move the mouse pointer and simulate button clicks (better: button press and release events separately, e.g. to do drag&drop). I found...
2
by: =?Utf-8?B?UmFqbmVlc2ggTmFyYWlu?= | last post by:
Hi, I have a ComboBox in a Windows app (.net2.0). And when users start typing into it, the dropdown populates itself from a webservice and gives relevant options under it... But the mouse hides...
18
Alireza355
by: Alireza355 | last post by:
Dear friends, I have a command button that when clicked, runs tens of queries, millions of calculations, etc. This process takes about 10 seconds each time, and the mouse pointer rapidly...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.