Hi,

This is my first ever post so I'll take this opportunity to thank all the talented people on this site for some great articles/tips. This is a great resource for new ASM programmers like myself and it has already helped me out on several occasions.

I've recently completed my first Win32 ASM program and it works fine and I'm very proud of it.
The only small problem I have is that I can't get a multi-line text box to respond to a TAB key. (For moving focus to the next control).

I use a resource file to create my controls and all the single line text boxes have entries like: -

EDITTEXT IDC_TEXTBOX1, 1, 1, 120, 12, ES_AUTOHSCROLL

These all respond correctly to the TAB key i.e. they pass focus to the next control.
As soon as I try any combination including the ES_MULTILINE description i.e.

EDITTEXT IDC_MLTEXTBOX1, 1, 1, 120, 12, ES_AUTOHSCROLL | ES_MULTILINE etc.

The TAB key stops working on that control when the program is run. (I.e. it doesn't pass focus to the next control.)
Does a multi-line box expect the programmer to trap the TAB key or might something be going wrong here?
Any advice would be brill thanks.

Keep up the good work,

Cutler

(P.S I'm using Windows 2000 if thats is any help).
Posted on 2002-10-08 07:41:09 by Cutler
Hi,

You need to add the style WS_TABSTOP to your Edit
Posted on 2002-10-08 10:08:12 by roticv
Thanks for pointing me in the right direction roticv, I hadn't tried WS_TABSTOP.

I've tried updating my rsrc file with the following: -

EDITTEXT IDC_MLTEXTBOX1, 1, 1, 100, 36, ES_LEFT | WS_BORDER | WS_TABSTOP | ES_MULTILINE etc.
EDITTEXT IDC_TEXTBOX1, 1, 60, 50, 12, ES_AUTOHSCROLL | WS_TABSTOP

But it still refuses to process my TAB key on the multi-line box.
As soon as I remove ES_MULTILINE the TAB works fine!

I'll keep plodding away to see if there is a winning combination with this.

(It dawned on me that rsrc files may not actually be classed as Win32 ASM programming so apologies if this is an 'off-topic' query).
Posted on 2002-10-08 11:28:39 by Cutler
Hey Cutler,

This is standard windows behaviour for just about as far back as I can
remember. *Usually*, in an MLE, if someone types a tab then they
will expect a tab to be inserted into the text they are typing; not for
it to jump focus to another control. To move focus to another control
that intercept the tab key you need to use Ctrl-Tab.

If this is the behaviour you would like to have then I would suggest
subclassing the control and handling the tab key manually.
Posted on 2002-10-08 15:36:44 by Graebel
Thanks for the advice Graebel.

I'm referring to default Visual Basic or Microsoft Access form behaviour where <Cntrl>+TAB inserts a TAB into the text and TAB on it's own switches the focus.

ES_MULTILINE is responding correctly to a <Cntrl>+TAB (it inserts a TAB into the text) but it does nothing when TAB is pressed on it's own.

Anyway I'll shut up about this now and consider your wise advise about subclassing.

Thanks again.
Posted on 2002-10-09 03:53:14 by Cutler