Hi,
Let me try to describe the situation in a little bit more detail. This code
will run in a kiosk, and will allow users to enter data to a couple of web
pages, on which I have no control.
The webbrowser control allows me to tap into key events using keypreview,
but I need a way to determine the context of keypress when it comes to
backspace. The user may be using backspace to erase a mistyped data, so I
need to allow backspace only when the focus is in a textbox, and cancel the
event on every other context.
I've just seen that there is an ActiveElement property, and I'll look into
it. I hope I can get the active element in htmldocument and using the tag
name, I can allow or disallow backspace keypress. (I do not have access to
my .net dev. environment at the moment)

Thanks for the suggestions and html editor link.  Actually I've written a
very complex app that used a webbrowser control as gui in 2002. I can barely
remember using some other technique that was based on implementing an
interface (a com interface I guess), but that's on old and faded memory now
:)

Cheers
Seref

On Fri, Aug 8, 2008 at 4:48 PM, Eames, Andrew <[EMAIL PROTECTED]> wrote:

> Yup - Set the KeyPreview property to true on the Form that hosts the
> control and handle the key events in the form
>  Andrew
>
> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of John Warner
> Sent: Friday, August 08, 2008 8:06 AM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: [Spam:***** SpamScore] Re: [ADVANCED-DOTNET] Webbrowser control
> and backspace key problem
> Importance: Low
>
> Can you not capture the keystrokes at the form level and 'cancel' them
> before they are bubbled to the control?
>
> John Warner
>
>
>
>
> > -----Original Message-----
> > From: Discussion of advanced .NET topics.
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> > Peter Ritchie
> > Sent: Friday, August 08, 2008 5:17 AM
> > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> > Subject: Re: [ADVANCED-DOTNET] Webbrowser control and
> > backspace key problem
> >
> >
> > You'd run into this problem with a number of controls--many
> > controls do something specific with certain keystrokes.
> >
> > I would recommend setting the focus away from the browser
> > control while in on-screen keyboard mode.  See the
> > ActiveControl property on the form.
> >
> >
> > On Fri, 8 Aug 2008 11:00:20 +0300, Seref Arikan
> > <[EMAIL PROTECTED]> wrote:
> >
> > >Hi,
> > >
> > >I am developing a desktop app that'll run on a touch screen
> > device, and
> > >it has to provide access to a series of web pages. the users have to
> > >use an on-screen keyboard to enter data to the web page.
> > >
> > >So I have to host webbrowser control, and users will need
> > backspace key
> > >to erase any mistyped data. The trouble is, webbrowser control
> > >interprets backspace key as go back when focus is not in a
> > textbox etc.
> > >
> > >I've seen a lot of tips, discussions etc, but none of them seems to
> > >cover this simple scenario. How do I prevent webbrowser control from
> > >going back due to a keypress from backspace key? I do not
> > have control
> > >over the displayed pages, so injecting a piece of javascript
> > is not an
> > >option. I'd really appreciate your comments, for I have lost a
> > >ridiciolus amount of
> > time
> > >for such a little annoying problem!
> >
> > ===================================
> > This list is hosted by DevelopMentorR  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> >
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
>
> --
> BEGIN-ANTISPAM-VOTING-LINKS
> ------------------------------------------------------
>
> Teach CanIt if this mail (ID 12312601) is spam:
> Spam:
> http://mail-gw.cognex.com/canit/b.php?c=s&i=12312601&m=c578ab8b04c9
> Not spam:
> http://mail-gw.cognex.com/canit/b.php?c=n&i=12312601&m=c578ab8b04c9
> Forget vote:
> http://mail-gw.cognex.com/canit/b.php?c=f&i=12312601&m=c578ab8b04c9
> ------------------------------------------------------
> END-ANTISPAM-VOTING-LINKS
>
> ===================================
> This list is hosted by DevelopMentor(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to