Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MouseDown, MouseUp, Mouseout events 1

Status
Not open for further replies.

ISPrincess

Programmer
Feb 22, 2002
318
US
Here is the background:

I have a datagrid in which i am programming client side events to enable multi-select or at least multi-highlighting.

Server side I added these 2 events in the Row_Databound event of the grid:
Code:
e.Item.Attributes.Add("OnClick", "HighlightRow( this );")
            e.Item.Attributes.Add("OnMouseOver", "HighlightRowMouse( this );")

The Code for the MouseOver event checks the value of a hidden input: txtIsMouseDown.

In the HTML I have a onMouseDown event which sets this txtIsMouseDown value=1 and I also have a onMouseUp event which sets txtISMouseDown value=0.

Code:
function CatchMouseKey(field, evt)
		{
			document.Form1.txtIsMouseDown.value=1;
		}
		function ClearMouseKey(field, evt)
		{
			document.Form1.txtIsMouseDown.value=0;
		}

In the javascript for the MouseOver Event, I check the value of this, and if it is 1, thereby giving the behavior of highlighting multiple rows as the user holds the mouse key down and mouse-overs.

This all works great until I access and click on the IE scroll bar on the right side of the page. This event must be setting txtIsMouseDown value=1 but never triggers the onMouseUp. If i click somewhere on my page the value is set back to 0 and all is well again.

Does anyone have any ideas on 1. what i may be doing wrong or 2. how to capture the fact that the user clicked on the right scroll bar?

I am a newbie, so please add some code sample if you have any suggestions.


PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 

ISPrincess said:
In the HTML I have a onMouseDown event which sets this txtIsMouseDown value=1

On which element? If the mousedown event is on the document or body, then try moving it to be on the table or associated rows or cells.

Hope this helps,
Dan
 
As i said, everything works as is until i click on the Internet explorer right hand scroll bar.

Can you explain how moving it would help, I dont understand.

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Oh, my lack of faith!

You were correct, that seems to have done it. Sorry to have doubted.

Thanks Billy

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top