Auto Tab Edit Controls

This is a discussion on Auto Tab Edit Controls within the Windows Programming forums, part of the Platform Specific Boards category; Hey, i'm thinking about writing a program where you would enter some numbers, but have separate edit controls for each ...

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    Auto Tab Edit Controls

    Hey, i'm thinking about writing a program where you would enter some numbers, but have separate edit controls for each number to be entered in. So I was wondering how I would make it so that after the user enters a number in one control, the program would automatically jump to the next edit control so the user can enter the next number.

    thanks.
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Ok first off I'm going to assume this is a child window not an dialog edit box control. It wouldn't be very hard to change around to work for an edit control though. Ok first off make a message loop for those controls:
    Code:
    LRESULT CALLBACK BoxProc(HWND,UINT,WPARAM,LPARAM);
    //then define it
    LRESULT CALLBACK BoxProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
    {
    switch(msg)
    {
    case EM_MAXTEXT:
    SetFocus(nextWnd);
    break;
    }
    return DefWindowProc(hwnd,msg,wParam,lParam);
    }
    To associate this procedure with the edit windows you might have to unregister the WNDCLASS after creating the initial window and register a new one that uses this. I think there is an easier way just can't remember it right now. Then when you create all those edit box windows use the same WNDCLASS for them all so they all will use this window procedure. Then when any of them reach their maximum text they will go to the next window. Remember to set nextWnd as a global HWND handle and make it grab the handle on the next window depending on which box is selected. Hope that helps, oh and don't forget to set a maximum text limit for those edit boxes. I'm kinda rushed so if I forgot something let me know.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 12:56 PM
  2. GetSystemMetrics for tab controls?
    By Magos in forum Windows Programming
    Replies: 2
    Last Post: 03-13-2006, 06:07 PM
  3. edit controls in dialogs
    By Homunculus in forum Windows Programming
    Replies: 10
    Last Post: 02-23-2006, 03:38 PM
  4. Edit controls of a dialog from another dialog...
    By Snake in forum Windows Programming
    Replies: 9
    Last Post: 07-01-2005, 03:18 PM
  5. Edit Controls - Colors - Messages
    By G'n'R in forum Windows Programming
    Replies: 3
    Last Post: 09-28-2003, 06:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21