Search:
Namespaces
Discussions
.NET v1.1
Feedback
RichTextBox Steals Focus
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngrichtextbox' list
.
Ward Bekker
Hi PPL,
I have multiple RichtTextBox on a page. When the page loads in internet
explorer, the focus jumps automatically to the last RichtTextBox on the
page. That causes the page to scroll down to the bottom, and I don't
want that. How can this be prevented?
Thank you very much,
Ward
Ps. I've send this answer a day earlier, but due to incorrect settings
my mail of that day has been lost.
Reply to this message...
Ollie Cornes
Hi Ward,
I think a good workaround for this is to add some script to the bottom
of the page (after the
RichTextBox
script) that sets focus to the first
control on your page.
Doe that work for you?
Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET
-----Original Message-----
From:
Click here to reveal e-mail address
[mailto:
Click here to reveal e-mail address
] On Behalf Of
Ward Bekker
Sent: 17 July 2002 10:55
To: aspngrichtextbox
Subject: [aspngrichtextbox]
RichTextBox
Steals Focus
Hi PPL,
I have multiple RichtTextBox on a page. When the page loads in internet
explorer, the focus jumps automatically to the last RichtTextBox on the
page. That causes the page to scroll down to the bottom, and I don't
want that. How can this be prevented?
Thank you very much,
Ward
Ps. I've send this answer a day earlier, but due to incorrect settings
my mail of that day has been lost.
| [aspngrichtextbox] member
Click here to reveal e-mail address
= YOUR ID |
http://www.aspfriends.com/aspfriends/aspngrichtextbox.asp
= JOIN/QUIT
Reply to this message...
Ward Bekker
Nop, doesn't work unfortunately. Because the Iframes of the RichtTextBox
requests focus after the body onLoad event triggers (or script on the
bottom of the page). I could work around it with a timer although, but
it's already a not so beautifull solution because the page bounces a lot
(4 RTB's requesting focus when loaded). So, this route is a big NO NO
;-)
The best solution is to supress the focus request of the Iframes. But
I've got a feeling that can't be supressed, and if it could, it should
be part of the RTB source code I think. What do you think?
-----Original Message-----
From: Ollie Cornes [mailto:
Click here to reveal e-mail address
]
Sent: woensdag 17 juli 2002 13:14
To: aspngrichtextbox
Subject: [aspngrichtextbox] RE:
RichTextBox
Steals Focus
Hi Ward,
I think a good workaround for this is to add some script to the bottom
of the page (after the
RichTextBox
script) that sets focus to the first
control on your page.
Doe that work for you?
Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET
-----Original Message-----
From:
Click here to reveal e-mail address
[mailto:
Click here to reveal e-mail address
] On Behalf Of
Ward Bekker
Sent: 17 July 2002 10:55
To: aspngrichtextbox
Subject: [aspngrichtextbox]
RichTextBox
Steals Focus
Hi PPL,
I have multiple RichtTextBox on a page. When the page loads in internet
explorer, the focus jumps automatically to the last RichtTextBox on the
page. That causes the page to scroll down to the bottom, and I don't
want that. How can this be prevented?
Thank you very much,
Ward
Ps. I've send this answer a day earlier, but due to incorrect settings
my mail of that day has been lost.
| [aspngrichtextbox] member
Click here to reveal e-mail address
= YOUR ID |
http://www.aspfriends.com/aspfriends/aspngrichtextbox.asp
= JOIN/QUIT
| [aspngrichtextbox] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/aspngrichtextbox.asp
= JOIN/QUIT
Reply to this message...
Ollie Cornes
I've marked this down to be fixed. The focus call is included in the
code as part of a fix to deal with a rendering bug in IE6. Previously
IE6 would fail to render strips of the document, so the solution is
definitely an improvement over the previous situation but I can see this
focus issue is a problem. The next release will not set focus unless you
explicitly ask it to.
Would you like to post your timer solution here? If you don't mind I'd
also like to add it to the knowledge base so others can make use of it.
I know it isn't going to be the best solution, but it's likely to be the
best we have for now.
I'm sorry for the problems this has caused.
Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET
[Original message clipped]
Reply to this message...
Ward Bekker
I didn't code a working version yet, but I think this concept would do
the job;
1. Call the procedure startCountDown() from your onload event of the
body (That's called when all HTML is rendered in the browser)
2. Include this script inside the head-tag of your document:
var timerID = 0;
var delay = 200 //the ugly part: the pause between the onload event and
re-requesting the focus. Find out what works for you (bandwidth/server
speed related)
function getFocusBack()
{
if(timerID) {
clearTimeout(timerID);
timerID = 0;
}
document.getElementById("anchor").focus();
}
function starCountDown()
{
timerID = setTimeout("getFocusBack()", delay);
}
3. place an anchor with the id "anchor" in the top of the document's
body.
This is a good example of A VERY BAD WAY to solve a problem like this,
but it's the first thing that popped into my mind :) A second solution
would be checking the focus state of the document with
document.hasFocus, so you don't have to guess the right timing, but I
don't know yet if an Iframe is considered as another document thus the
main document loses the focus.
I will post the final solution here later on (don't hold your breath
though :) )
Ollie; Thank you very much for adding this feature in the next release.
When do you think the next release will be available? :)
-----Original Message-----
From: Ollie Cornes [mailto:
Click here to reveal e-mail address
]
Sent: woensdag 17 juli 2002 14:15
To: aspngrichtextbox
Subject: [aspngrichtextbox] RE:
RichTextBox
Steals Focus
I've marked this down to be fixed. The focus call is included in the
code as part of a fix to deal with a rendering bug in IE6. Previously
IE6 would fail to render strips of the document, so the solution is
definitely an improvement over the previous situation but I can see this
focus issue is a problem. The next release will not set focus unless you
explicitly ask it to.
Would you like to post your timer solution here? If you don't mind I'd
also like to add it to the knowledge base so others can make use of it.
I know it isn't going to be the best solution, but it's likely to be the
best we have for now.
I'm sorry for the problems this has caused.
Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET
[Original message clipped]
| [aspngrichtextbox] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/aspngrichtextbox.asp
= JOIN/QUIT
Reply to this message...
System.Windows.Forms.RichTextBox
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com