NO

Author Topic: Auto advancing to the next windows control  (Read 4533 times)

tpekar

  • Guest
Auto advancing to the next windows control
« on: December 06, 2012, 05:18:11 PM »
I am trying to change a windows edit control to accept only one character and automatically advance to the next edit control.  I used a SETLIMITTEXT message to limit the text to one character but the MAXTEXT only activates when the user tries to key a second character into the edit box.  I want to activate after the first character is entered.  What is the easiest way to do this?

CommonTater

  • Guest
Re: Auto advancing to the next windows control
« Reply #1 on: December 06, 2012, 05:43:49 PM »
Trap the EN_CHANGE notification and use SetFocus() to move to the next control.


tpekar

  • Guest
Re: Auto advancing to the next windows control
« Reply #2 on: December 06, 2012, 08:26:41 PM »
EN_CHANGE is the HIWORD of wParam.  What is the LOWORD?  Is it the handle to the current window?

tpekar

  • Guest
Re: Auto advancing to the next windows control
« Reply #3 on: December 06, 2012, 09:32:07 PM »
I put EN_CHANGE for the HIWORD of wParam and it worked except that EN_CHANGE seemed to be activated when the controls were created.  If I change the contents of a control with a SetWindowText, does this activate EN_CHANGE?

CommonTater

  • Guest
Re: Auto advancing to the next windows control
« Reply #4 on: December 07, 2012, 02:01:33 AM »
EN_CHANGE is the HIWORD of wParam.  What is the LOWORD?  Is it the handle to the current window?

You really do need to learn how to look this stuff up for yourself...

http://msdn.microsoft.com/en-us/library/windows/desktop/bb761676(v=vs.85).aspx

The high word is the en_change notification, the low word is the HMENU value you assigned it when you created the control...

The window handle is in Lparam ... as it is for all WM_COMMAND messages.

CommonTater

  • Guest
Re: Auto advancing to the next windows control
« Reply #5 on: December 07, 2012, 02:03:23 AM »
I put EN_CHANGE for the HIWORD of wParam and it worked except that EN_CHANGE seemed to be activated when the controls were created.  If I change the contents of a control with a SetWindowText, does this activate EN_CHANGE?

Now, can you think of a way to test that?

(Hint: Anything that changes the text triggers it.)