473,770 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disable scroll

hey all,

can someone please tell me if you can disable the scroll button for a
dropdownlist. For example, when you select an item in a dropdownlist and it
still has focus and you accidently hit scroll wheel on your mouse the
selected item changes.

can this be disabled?

thanks,
rodchar
Nov 19 '05 #1
8 2534
No.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
hey all,

can someone please tell me if you can disable the scroll button for a
dropdownlist. For example, when you select an item in a dropdownlist and
it
still has focus and you accidently hit scroll wheel on your mouse the
selected item changes.

can this be disabled?

thanks,
rodchar

Nov 19 '05 #2
Rodchar,

Depending on how your site is set up you may be able to take care of this. I
find the list still being selected to be a problem after a page is posted
back (say when filtering a datagrid) and then, when the filtered results are
returned the scroll wheel is accidentally clicked starting the process over
again.

I use a javascript on post back to place the focus onto something else on
the page.

So, for example, in the post back event handler of the submit button (or the
drop down list itself if it's set to autopostback) I use a startup script
like:

Page.RegisterSt artupScript("My FocusScript", "<script
language=""java script"">docume nt.getElementBy Id('MyDataGridC lientIdHere');</script>")

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
hey all,

can someone please tell me if you can disable the scroll button for a
dropdownlist. For example, when you select an item in a dropdownlist and
it
still has focus and you accidently hit scroll wheel on your mouse the
selected item changes.

can this be disabled?

thanks,
rodchar

Nov 19 '05 #3
Kevin Spencer wrote:
No.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
hey all,

can someone please tell me if you can disable the scroll button for a
dropdownlist. For example, when you select an item in a dropdownlist and
it
still has focus and you accidently hit scroll wheel on your mouse the
selected item changes.

can this be disabled?

thanks,
rodchar

Sorry, cant see original message, but I'd say try something like the
following:

<asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
false;"></asp:DropDownLis t>

The onmousewheel will probably get a syntax wobbly line, but I think
that should work (or you can add it via code if you want/if it doesn't
work)

Damien

Nov 19 '05 #4
that worked great, thanks. thanks everyone for the great feedback.

"Damien" wrote:
Kevin Spencer wrote:
No.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
hey all,

can someone please tell me if you can disable the scroll button for a
dropdownlist. For example, when you select an item in a dropdownlist and
it
still has focus and you accidently hit scroll wheel on your mouse the
selected item changes.

can this be disabled?

thanks,
rodchar

Sorry, cant see original message, but I'd say try something like the
following:

<asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
false;"></asp:DropDownLis t>

The onmousewheel will probably get a syntax wobbly line, but I think
that should work (or you can add it via code if you want/if it doesn't
work)

Damien

Nov 19 '05 #5
> <asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
false;"></asp:DropDownLis t>

The onmousewheel will probably get a syntax wobbly line, but I think
that should work (or you can add it via code if you want/if it doesn't
work)
This will not prevent the select object from scrolling. I tested it with a
pure HTML form. In addition, the "onmousewhe el" event is proprietary to
Microsoft IE.

Justin did have an idea I hadn't thought of. However, he didn't post the
JavaScript correctly (it referenced the element, but didn't write what it
should do):

Page.RegisterSt artupScript("My FocusScript", "<script
language=""java script"">docume nt.getElementBy Id('MyDataGridC lientIdHere');</script>")

I believe he meant:

Page.RegisterSt artupScript("My FocusScript", "<script
language=""java script"">docume nt.getElementBy Id('MyDataGridC lientIdHere').f ocus();</script>")

This does not prevent the user from putting the focus on the select object
and scrolling the mouse wheel, however. It does set the focus elsewhere when
the page loads.

On the other hand, it did make me think. Assuming again that *all of your
users are using IE*, you COULD keep the "onmousewhe el" event from changing
the SelectedIndex of the select object. This would require a global
JavaScript variable to store the current SelectedIndex of the select object
in, and another to prevent the select object's "onchange" event from doing
anything. You could define a JavaScript function that handles the
"onmousewhe el" event. It would check the global Selectedindex variable, set
the global "prevent" variable to true, set the select object's SelectedIndex
to the value of the variable, set the window.event.ca ncelBubble property to
true, which cancels the event from bubbling up, and reset the global
"prevent" variable to false. In addition, you would need an "onchange" event
for the select object itself, which first checks the prevent variable, and
if false, sets the global SelectedIndex variable to the new select object's
SelectedIndex.

Now, if anyone is NOT using IE, this should not prevent anything from
happening normally, but will prevent the "onmousewhe el" event from changing
the SelectedIndex property of the select object on IE.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Damien" <Da************ *******@hotmail .com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com... Kevin Spencer wrote:
No.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
> hey all,
>
> can someone please tell me if you can disable the scroll button for a
> dropdownlist. For example, when you select an item in a dropdownlist
> and
> it
> still has focus and you accidently hit scroll wheel on your mouse the
> selected item changes.
>
> can this be disabled?
>
> thanks,
> rodchar

Sorry, cant see original message, but I'd say try something like the
following:

<asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
false;"></asp:DropDownLis t>

The onmousewheel will probably get a syntax wobbly line, but I think
that should work (or you can add it via code if you want/if it doesn't
work)

Damien

Nov 19 '05 #6
Kevin,

Thanks for noticing that I forgot .focus() in that script!

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
<asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
false;"></asp:DropDownLis t>

The onmousewheel will probably get a syntax wobbly line, but I think
that should work (or you can add it via code if you want/if it doesn't
work)


This will not prevent the select object from scrolling. I tested it with a
pure HTML form. In addition, the "onmousewhe el" event is proprietary to
Microsoft IE.

Justin did have an idea I hadn't thought of. However, he didn't post the
JavaScript correctly (it referenced the element, but didn't write what it
should do):

Page.RegisterSt artupScript("My FocusScript", "<script
language=""java script"">docume nt.getElementBy Id('MyDataGridC lientIdHere');</script>")

I believe he meant:

Page.RegisterSt artupScript("My FocusScript", "<script
language=""java script"">docume nt.getElementBy Id('MyDataGridC lientIdHere').f ocus();</script>")

This does not prevent the user from putting the focus on the select object
and scrolling the mouse wheel, however. It does set the focus elsewhere
when the page loads.

On the other hand, it did make me think. Assuming again that *all of your
users are using IE*, you COULD keep the "onmousewhe el" event from
changing the SelectedIndex of the select object. This would require a
global JavaScript variable to store the current SelectedIndex of the
select object in, and another to prevent the select object's "onchange"
event from doing anything. You could define a JavaScript function that
handles the "onmousewhe el" event. It would check the global Selectedindex
variable, set the global "prevent" variable to true, set the select
object's SelectedIndex to the value of the variable, set the
window.event.ca ncelBubble property to true, which cancels the event from
bubbling up, and reset the global "prevent" variable to false. In
addition, you would need an "onchange" event for the select object itself,
which first checks the prevent variable, and if false, sets the global
SelectedIndex variable to the new select object's SelectedIndex.

Now, if anyone is NOT using IE, this should not prevent anything from
happening normally, but will prevent the "onmousewhe el" event from
changing the SelectedIndex property of the select object on IE.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"Damien" <Da************ *******@hotmail .com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
Kevin Spencer wrote:
No.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
> hey all,
>
> can someone please tell me if you can disable the scroll button for a
> dropdownlist. For example, when you select an item in a dropdownlist
> and
> it
> still has focus and you accidently hit scroll wheel on your mouse the
> selected item changes.
>
> can this be disabled?
>
> thanks,
> rodchar

Sorry, cant see original message, but I'd say try something like the
following:

<asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
false;"></asp:DropDownLis t>

The onmousewheel will probably get a syntax wobbly line, but I think
that should work (or you can add it via code if you want/if it doesn't
work)

Damien


Nov 19 '05 #7
Kevin Spencer wrote:
<asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
false;"></asp:DropDownLis t>

The onmousewheel will probably get a syntax wobbly line, but I think
that should work (or you can add it via code if you want/if it doesn't
work)


This will not prevent the select object from scrolling. I tested it with a
pure HTML form. In addition, the "onmousewhe el" event is proprietary to
Microsoft IE.

Well, it seems to work here. Admittedly, yes, only for IE. But shooting
for the LCD (IE user insult coming up here), it's those users who are
least likely to spot what is happening with the mousewheel.

I'm using IE 6, and the following markup works:

<html>
<head>
<title>Must have a Title</title>
</head>
<body>
<select onmousewheel="r eturn false;"><option
value="1">1</option><option value="2">2</option><option value="square
root of 2">3</option></select>
</body>
</html>

(Incidentally, it also appears to work in Opera?)

Damien

Nov 19 '05 #8
Well, I'll be darned, Damien. I tested your code, and it did indeed work! I
wish I had posted my own experiment so that I could see what the difference
was, but it is lost to me forever. Perhaps it was just too early in the
morning for me, I just don't know.

In any case, I stand corrected. My apologies.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Damien" <Da************ *******@hotmail .com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Kevin Spencer wrote:
> <asp:DropDownLi st id="blah" runat="server" onmousewheel="r eturn
> false;"></asp:DropDownLis t>
>
> The onmousewheel will probably get a syntax wobbly line, but I think
> that should work (or you can add it via code if you want/if it doesn't
> work)


This will not prevent the select object from scrolling. I tested it with
a
pure HTML form. In addition, the "onmousewhe el" event is proprietary to
Microsoft IE.

Well, it seems to work here. Admittedly, yes, only for IE. But shooting
for the LCD (IE user insult coming up here), it's those users who are
least likely to spot what is happening with the mousewheel.

I'm using IE 6, and the following markup works:

<html>
<head>
<title>Must have a Title</title>
</head>
<body>
<select onmousewheel="r eturn false;"><option
value="1">1</option><option value="2">2</option><option value="square
root of 2">3</option></select>
</body>
</html>

(Incidentally, it also appears to work in Opera?)

Damien

Nov 19 '05 #9

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

Similar topics

2
2335
by: Ben | last post by:
I've got an asp page that populates a listbox with info from a db. The list box ends up being pretty big, so I want to be able to search it effectively. I like the method wherein the user types the letters of the word they are looking for from within the listbox and the control automatically scrolls to the item matching the chars they have typed thus far. Example:
3
16539
by: David Rwj Cherry CS2000 | last post by:
is there any way to disable or lock vertical scroll bars on a browser window? im a newbie and i just don't want them to appear on my screen. sometimes they appear on IE but not on mozilla. any ideas would be most appreciated.
2
2631
by: Chris DiPierro | last post by:
Is there a way to disable scroll wheel support in a combobox? Basically, I have a situation where a user chooses an option in a combobox. I'm handling the selected index change event, and due to the option they chose, the combobox itself is being destroyed (dynamic UI). However, if they've managed to choose an option and then roll the scroll wheel, I'll get an unhandled exception when Windows tries to fire the events associated with...
0
1857
by: rawCoder | last post by:
If an item is added in a grid, then the grid scrolls automatically either to bring the selected or the last entered item in focus. Is there a way to disable this scrolling. Means, If I am looking at item number 500 and the item number 100 is selected and an item is added at the top. Then grid doesnt scroll anywhere and item number 500 keeps in view. Is it possible ?
1
3334
by: nicholas | last post by:
Hi, If on an asp.net page the user has just selected a value in a dropdownlist and scrolls with the wheel of his mouse, the selected value of the dropdownlist will change. How could I avoid this. So how could I disable the mouse scrolling that dropdownlist. Or how could I disable the mouse-scroll on those pages.
2
2715
by: nicholas | last post by:
On an aspx page I have a webform with an asp:DropDownList control. If the visitor selects a value in the dropdown and than want to scroll down the page, he accidently changes the selected value of the dropdown. So, is it possible to disable this? THX
0
1741
by: Al | last post by:
Hi I like to replace a character at the click of mouse. My main problem is when I click on the characters that need to be changing the richTextBox will scroll up make it very distracting. Is there anyway that I can disable scrolling? Here is what the simple code aRichtext.Text = aRichtext.Text.Remove(position, 1) aRichtext.Text = aRichtext.Text.Insert(position, "N") aRichtext.Select(position, 1)
7
2446
by: John den Haan | last post by:
Hello! When I use putchar to fill up an entire screen (of 80x25) with text, it seems to leave an empty line at the end, thus forcing me to scroll upwards in to see the first line. This forces me to repositioning the cursor to the first line, which costs computer power. I know the loss is negligible, but it's more a matter of principle: how to prevent this line-wrapping behaviour? --
1
4362
by: newbie009 | last post by:
How can I disable horizontal scroll in textbox for FireFox? Right now 1 textbox has vertical scroll and other textbox has horizontal scroll. It only looks like this on FireFox but it looks ugly. http://jumbofiles.com/example.gif I used this code but it only worked for IE not FireFox: style="overflow: scroll; overflow-y: scroll; overflow-x: hidden; overflow:-moz-scrollbars-vertical;" Basically I want only vertical scroll.
0
9617
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.