Thread: Auto Tab Edit Controls

  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, 11:56 AM
  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, 02:18 PM
  5. Edit Controls - Colors - Messages
    By G'n'R in forum Windows Programming
    Replies: 3
    Last Post: 09-28-2003, 05:21 AM