Results 1 to 2 of 2

Thread: MDI & Keypress

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    UK
    Posts
    45

    Post

    I've got an MDI program with sub "child" windows. I need the program to run a sub when a particular key is pressed eg:

    Private Sub Form_KeyDown
    if keycode=100 then cmd_click
    End Sub

    Child forms will do this but no the MDI form. Unfortunately if I've got more than one child window open at once then the above code on one child will not work from another.
    The keys need to do this through the whole program.

    Any ideas?

  2. #2
    Junior Member
    Join Date
    Oct 1999
    Posts
    31

    Post

    I am not sure if there is an easy way of doing that. So here is my complex solution

    1. You can design a global message controller which can dispatch messages to all active forms.
    2. You have to put the code to call the message controller in all child forms.
    4. On all your form, add a command button (cmdExec) and make it invisible. Add the code you want to execute in the click event of the command button.
    5. In the global controller, loop through the forms collection and execute the code:

    Form(i).cmdExec.value=True

    The above statement will cause the click event of cmdExec to execute.

    HTH!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width