Capturing ESC key in DataReport Window


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Capturing ESC key in DataReport Window

  1. #1
    Jeff Ross Guest

    Capturing ESC key in DataReport Window

    Hello,

    A friend wants to be able to press ESC in a DataReport window and have the
    window close. I'm not finding any events/properties within the DataReport
    to help with this like you can in a Form_KeyDown event. I know the
    DataReport is very limited. Still maybe there is an API way of solving the
    problem.

    Any suggestions?

    Thanks,
    Jeff Ross



  2. #2
    Michael Shutt Guest

    Re: Capturing ESC key in DataReport Window

    One easy way would be to add a "Close" button and set its .Cancel property
    to True. In the click event you just Hide or Unload the form.

    --
    Michael Shutt

    Please respond to newsgroup as I will not return direct emails.

    "Jeff Ross" <jeffkross@yahoo.com> wrote in message
    news:3b26ca3e$1@news.devx.com...
    > Hello,
    >
    > A friend wants to be able to press ESC in a DataReport window and have the
    > window close. I'm not finding any events/properties within the DataReport
    > to help with this like you can in a Form_KeyDown event. I know the
    > DataReport is very limited. Still maybe there is an API way of solving

    the
    > problem.
    >
    > Any suggestions?
    >
    > Thanks,
    > Jeff Ross
    >
    >




  3. #3
    Michael Shutt Guest

    Re: Capturing ESC key in DataReport Window

    One easy way would be to add a "Close" button and set its .Cancel property
    to True. In the click event you just Hide or Unload the form.

    --
    Michael Shutt

    Please respond to newsgroup as I will not return direct emails.

    "Jeff Ross" <jeffkross@yahoo.com> wrote in message
    news:3b26ca3e$1@news.devx.com...
    > Hello,
    >
    > A friend wants to be able to press ESC in a DataReport window and have the
    > window close. I'm not finding any events/properties within the DataReport
    > to help with this like you can in a Form_KeyDown event. I know the
    > DataReport is very limited. Still maybe there is an API way of solving

    the
    > problem.
    >
    > Any suggestions?
    >
    > Thanks,
    > Jeff Ross
    >
    >




  4. #4
    Jeff Ross Guest

    Re: Capturing ESC key in DataReport Window

    I'm not wanting to hide or close a form, but a datareport window. The
    standard controls such as command buttons are not available to add to a
    datareport window.

    Jeff

    Michael Shutt wrote in message <3b274a85@news.devx.com>...
    >One easy way would be to add a "Close" button and set its .Cancel property
    >to True. In the click event you just Hide or Unload the form.
    >
    >--
    >Michael Shutt
    >
    >Please respond to newsgroup as I will not return direct emails.
    >





  5. #5
    Jeff Ross Guest

    Re: Capturing ESC key in DataReport Window

    I'm not wanting to hide or close a form, but a datareport window. The
    standard controls such as command buttons are not available to add to a
    datareport window.

    Jeff

    Michael Shutt wrote in message <3b274a85@news.devx.com>...
    >One easy way would be to add a "Close" button and set its .Cancel property
    >to True. In the click event you just Hide or Unload the form.
    >
    >--
    >Michael Shutt
    >
    >Please respond to newsgroup as I will not return direct emails.
    >





  6. #6
    James Abbott Guest

    Re: Capturing ESC key in DataReport Window

    Use getkeystate and check if the escape key is pressed
    put the following into a module
    Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As
    Integer

    then put the following into your source

    If GetKeyState(vbKeyEscape) = 1 Then
    'Add code for the closing of it
    End If

    This will check if the escape key is pressed, then you just have to check
    wether the DataReport window has focus and if it does, close it. You may
    have some problems with if getkeystate = 1 might want the opposite number.
    Eg: if the key is pressed the first time it changes to 1, then the second it
    changes to 0, and so on. If you have this problem, email me, i've got some
    code to fix it somewhere.

    James Abbott

    Jeff Ross <jeffkross@yahoo.com> wrote in message
    news:3b26ca3e$1@news.devx.com...
    > Hello,
    >
    > A friend wants to be able to press ESC in a DataReport window and have the
    > window close. I'm not finding any events/properties within the DataReport
    > to help with this like you can in a Form_KeyDown event. I know the
    > DataReport is very limited. Still maybe there is an API way of solving

    the
    > problem.
    >
    > Any suggestions?
    >
    > Thanks,
    > Jeff Ross
    >
    >




  7. #7
    James Abbott Guest

    Re: Capturing ESC key in DataReport Window

    Use getkeystate and check if the escape key is pressed
    put the following into a module
    Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As
    Integer

    then put the following into your source

    If GetKeyState(vbKeyEscape) = 1 Then
    'Add code for the closing of it
    End If

    This will check if the escape key is pressed, then you just have to check
    wether the DataReport window has focus and if it does, close it. You may
    have some problems with if getkeystate = 1 might want the opposite number.
    Eg: if the key is pressed the first time it changes to 1, then the second it
    changes to 0, and so on. If you have this problem, email me, i've got some
    code to fix it somewhere.

    James Abbott

    Jeff Ross <jeffkross@yahoo.com> wrote in message
    news:3b26ca3e$1@news.devx.com...
    > Hello,
    >
    > A friend wants to be able to press ESC in a DataReport window and have the
    > window close. I'm not finding any events/properties within the DataReport
    > to help with this like you can in a Form_KeyDown event. I know the
    > DataReport is very limited. Still maybe there is an API way of solving

    the
    > problem.
    >
    > Any suggestions?
    >
    > Thanks,
    > Jeff Ross
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center