Button focus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    Button focus

    Can I trigger a button press event without putting focus
    on the button? I am making a form full of buttons that
    can be used as a keyboard on a touchscreen. If I have a
    textbox which has focus and I click the 'Q' button on the
    form which represents the 'Q' key on the keyboard,
    nothing gets printed into the textbox because the textbox
    loses focus. Any suggestions would be greatly
    appreciated. Thanks for your reply.

    Mike

    ps. Any links to code samples of touchscreen C# programs
    would also be greatly appreciated.
  • Champika Nirosh

    #2
    Re: Button focus

    cannot be ... not sure i got what you need correctly..

    do you really need to have the focus to the text box inoder for you to add a
    text to the text box..

    Do you need to insert text as well??

    Nirosh.

    "Mike" <mikebiros@hotm ail.com> wrote in message
    news:7d6201c3b4 99$ec3c8110$a60 1280a@phx.gbl.. .[color=blue]
    > Can I trigger a button press event without putting focus
    > on the button? I am making a form full of buttons that
    > can be used as a keyboard on a touchscreen. If I have a
    > textbox which has focus and I click the 'Q' button on the
    > form which represents the 'Q' key on the keyboard,
    > nothing gets printed into the textbox because the textbox
    > loses focus. Any suggestions would be greatly
    > appreciated. Thanks for your reply.
    >
    > Mike
    >
    > ps. Any links to code samples of touchscreen C# programs
    > would also be greatly appreciated.[/color]


    Comment

    • Mike

      #3
      Re: Button focus

      Its just an example. I might have several textboxes so I
      want to be able to click a button which will insert text
      in whatever textbox has focus...but the textbox will lose
      focus so I won't know which textbox to insert the text
      into. I hope that makes sense.
      [color=blue]
      >-----Original Message-----
      >cannot be ... not sure i got what you need correctly..
      >
      >do you really need to have the focus to the text box[/color]
      inoder for you to add a[color=blue]
      >text to the text box..
      >
      >Do you need to insert text as well??
      >
      >Nirosh.
      >
      >"Mike" <mikebiros@hotm ail.com> wrote in message
      >news:7d6201c3b 499$ec3c8110$a6 01280a@phx.gbl. ..[color=green]
      >> Can I trigger a button press event without putting[/color][/color]
      focus[color=blue][color=green]
      >> on the button? I am making a form full of buttons that
      >> can be used as a keyboard on a touchscreen. If I have[/color][/color]
      a[color=blue][color=green]
      >> textbox which has focus and I click the 'Q' button on[/color][/color]
      the[color=blue][color=green]
      >> form which represents the 'Q' key on the keyboard,
      >> nothing gets printed into the textbox because the[/color][/color]
      textbox[color=blue][color=green]
      >> loses focus. Any suggestions would be greatly
      >> appreciated. Thanks for your reply.
      >>
      >> Mike
      >>
      >> ps. Any links to code samples of touchscreen C#[/color][/color]
      programs[color=blue][color=green]
      >> would also be greatly appreciated.[/color]
      >
      >
      >.
      >[/color]

      Comment

      • Champika Nirosh

        #4
        Re: Button focus

        Hi,

        I think you have to keep a reference of the last activated text box and
        force it to be focused before inserting the text.

        here I think you can use mouse click of mouse up event..

        Nirosh.

        "Mike" <mikebiros@hotm ail.com> wrote in message
        news:08e401c3b4 ad$8992b160$a10 1280a@phx.gbl.. .[color=blue]
        > Its just an example. I might have several textboxes so I
        > want to be able to click a button which will insert text
        > in whatever textbox has focus...but the textbox will lose
        > focus so I won't know which textbox to insert the text
        > into. I hope that makes sense.
        >[color=green]
        > >-----Original Message-----
        > >cannot be ... not sure i got what you need correctly..
        > >
        > >do you really need to have the focus to the text box[/color]
        > inoder for you to add a[color=green]
        > >text to the text box..
        > >
        > >Do you need to insert text as well??
        > >
        > >Nirosh.
        > >
        > >"Mike" <mikebiros@hotm ail.com> wrote in message
        > >news:7d6201c3b 499$ec3c8110$a6 01280a@phx.gbl. ..[color=darkred]
        > >> Can I trigger a button press event without putting[/color][/color]
        > focus[color=green][color=darkred]
        > >> on the button? I am making a form full of buttons that
        > >> can be used as a keyboard on a touchscreen. If I have[/color][/color]
        > a[color=green][color=darkred]
        > >> textbox which has focus and I click the 'Q' button on[/color][/color]
        > the[color=green][color=darkred]
        > >> form which represents the 'Q' key on the keyboard,
        > >> nothing gets printed into the textbox because the[/color][/color]
        > textbox[color=green][color=darkred]
        > >> loses focus. Any suggestions would be greatly
        > >> appreciated. Thanks for your reply.
        > >>
        > >> Mike
        > >>
        > >> ps. Any links to code samples of touchscreen C#[/color][/color]
        > programs[color=green][color=darkred]
        > >> would also be greatly appreciated.[/color]
        > >
        > >
        > >.
        > >[/color][/color]


        Comment

        • Morten Wennevik

          #5
          Re: Button focus

          Capture the killfocus event on the textboxes to track which one had the
          focus

          --
          Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

          Comment

          • Ron McNulty

            #6
            Re: Button focus

            Hi Mark

            This was a hard ask, even under standard C++/Delphi/Windows. The only
            comprehensive solution was to install a CBT Windows hook that could truly
            send keystroke events to anything in an application (including menus, modal
            dialogs et al).

            You may find this even more difficult to do under a managed framework.

            Regards

            Ron


            "Mike" <mikebiros@hotm ail.com> wrote in message
            news:7d6201c3b4 99$ec3c8110$a60 1280a@phx.gbl.. .[color=blue]
            > Can I trigger a button press event without putting focus
            > on the button? I am making a form full of buttons that
            > can be used as a keyboard on a touchscreen. If I have a
            > textbox which has focus and I click the 'Q' button on the
            > form which represents the 'Q' key on the keyboard,
            > nothing gets printed into the textbox because the textbox
            > loses focus. Any suggestions would be greatly
            > appreciated. Thanks for your reply.
            >
            > Mike
            >
            > ps. Any links to code samples of touchscreen C# programs
            > would also be greatly appreciated.[/color]


            Comment

            Working...