auto tab to next edit control 
Author Message
 auto tab to next edit control

I have a series of edit controls.  I'd like to have the curser go to the
next edit control once the user has entered a value in an edit box
(without having to use the tab key).  The behavior is similiar to what
you would see when you are entering a registration code for piece of
software and the curser moves from edit control to edit control as the
characters are entered.

If a user is entering characters into an edit control, what windows
messages are sent to that control that can be captured?  In other words,
in what message event can I test to see if the cursor should go
automatically to the next edit control?

Have any code sample?

Maggie



Mon, 17 Mar 2003 03:00:00 GMT  
 auto tab to next edit control

Use the textboxes' Change event. I'd suggest making the text
boxes an array, and setting their MaxLength property appropriately.
Then use the following Change event code:

Private Sub Text1_Change(Index As Integer)
  With Text1(Index)
    If Len(.Text) = .MaxLength Then
      If Index = Text1.Count-1 Then
        Text1(0).SetFocus
      Else
        Text1(Index+1).SetFocus
      End If
    End If
  End With
End Sub

I put this up without testing, may need minor updates.
Yours, Nikolaus


Quote:
> I have a series of edit controls.  I'd like to have the curser go to the
> next edit control once the user has entered a value in an edit box
> (without having to use the tab key).  The behavior is similiar to what
> you would see when you are entering a registration code for piece of
> software and the curser moves from edit control to edit control as the
> characters are entered.

> If a user is entering characters into an edit control, what windows
> messages are sent to that control that can be captured?  In other words,
> in what message event can I test to see if the cursor should go
> automatically to the next edit control?

> Have any code sample?

> Maggie



Mon, 17 Mar 2003 03:00:00 GMT  
 auto tab to next edit control

Sorry for my last reply, thought I was in VB newsgroup.
Yours, Nikolaus

Quote:
> I have a series of edit controls.  I'd like to have the curser go to the
> next edit control once the user has entered a value in an edit box
> (without having to use the tab key).  The behavior is similiar to what
> you would see when you are entering a registration code for piece of
> software and the curser moves from edit control to edit control as the
> characters are entered.

> If a user is entering characters into an edit control, what windows
> messages are sent to that control that can be captured?  In other words,
> in what message event can I test to see if the cursor should go
> automatically to the next edit control?

> Have any code sample?

> Maggie



Mon, 17 Mar 2003 03:00:00 GMT  
 auto tab to next edit control

The edit control will send an EN_CHANGE (MFC: ON_EN_CHANGE) message when
text is entered. You can capture this, check the length. When the
length/value/etc is what you want, call CDialog::GotoDlgCtrl(...).

Hope this helps.

--
Chris Burnette
E-OIR Measurements, Inc.

If replying by e-mail, delete the NOSPAM from the address.


Quote:
> I have a series of edit controls.  I'd like to have the curser go to the
> next edit control once the user has entered a value in an edit box
> (without having to use the tab key).  The behavior is similiar to what
> you would see when you are entering a registration code for piece of
> software and the curser moves from edit control to edit control as the
> characters are entered.

> If a user is entering characters into an edit control, what windows
> messages are sent to that control that can be captured?  In other words,
> in what message event can I test to see if the cursor should go
> automatically to the next edit control?

> Have any code sample?

> Maggie



Mon, 17 Mar 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Auto Advance to next control?

2. Script Edit control with Auto-Completion (and ofcourse syntax highlighting)

3. Auto highlight text in Edit control

4. Edit Control...Edit Control...Edit Control...Edit Control...Edit Control...

5. Toolbars auto-repositioning on next line

6. Can't Tab to Subclassed Edit Control

7. Line feeds and tabs in an edit control

8. Tabs in Rich Edit control

9. Rich edit control problem (Focus not changing with tab)

10. Richtext edit box ocx problem with VC. (Tab is not working with control)

11. Rich Edit Controls & Tabs

12. rich edit control: tab and indent

 

 
Powered by phpBB® Forum Software