Results 1 to 6 of 6

Thread: Key press to click a button

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Scotland
    Posts
    64

    Key press to click a button

    I am writing an ATM program for college and I have command buttons called
    cmd1
    cmd2
    cmd3
    ...
    cmd0

    How can I get the button to depress as the user hits the corresponding number key ?

    Thanks.
    AMD Athlon 1.0 GHz
    128MB RAM
    GeForce 2 MX
    30 GB HD

  2. #2

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    i assume you have your code in cmd1.. this is not a effecient way of doing it

    what ever code you have in the cmd's
    put them in functions and procedures
    then in cmd1 make the call to this function
    and on keypress call the same function..

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Scotland
    Posts
    64
    Where do I put the If statement ? And how would I move from one textbox after its accepted 6 characters onto the next ?
    AMD Athlon 1.0 GHz
    128MB RAM
    GeForce 2 MX
    30 GB HD

  5. #5
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    let say you have a textbox called"

    txtinput

    after you hit ENTER in this you want the cmd to be clicked basically

    so in the txtinput's KEYPRESS event
    you put the if statement

    if you want to automatically move from one textbox after it has 6 chars in it use this in the CHANGE event of the textbox

    if len(txtinput.text) => 6 then
    txtmyother.setFocus
    end if

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    If you want to jump code from one to the other it's a lot easier if you use a control array of buttons. Attached is a little sample of how it would work...I use only 1 characer and not six but I am changing on index..you can adjust the code to compensate for whatever..it's just the idea of a control array I am offering.
    Attached Files Attached Files
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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