need some quick psuedo code or code please...

I have createwindowex set up to open an edit box. How would I set it up like a chat-type window.. ie i can type whatever I want into it, when finished hit the 'enter' key and it is sent to a 'viewing field' and I can enter another line of text.

I have tried using VK_RETURN in the WM_COMMAND section of the callback windowprocedure(....) to somewhat avail... it works if the client has the main focus. I would like to get the edit box to be able to detect VK_RETURN (when the enter key is pressed).

thnx for ur continuing support.

l8a
Posted on 2001-09-25 04:53:28 by drarem
You will need to specify the edit control as multi line (ES_MULTILINE), and using the style ES_WANTRETURN.

You need the ES_MULTILINE as ES_WANTRETURN has no effect on single line edit controls. You don't need the multi line feature, and by intercepting the key press the user will never know!

Mirno
Posted on 2001-09-25 04:58:01 by Mirno
The following is in PowerBASIC but it will do what you need with a multiline rich edit control.

' ##########################################################################

SUB Showtext(a$)

' ------------------------------------------------------------------
' this appends text to the end of the text in the rich edit control
' ------------------------------------------------------------------
LOCAL Cr as CHARRANGE

tl& = GetWindowTextLength(hOutput)
Cr.cpMin = tl&
Cr.cpMax = tl&
SendMessage hOutput,%EM_EXSETSEL,0,ByVal VarPtr(Cr)

b$ = a$+chr$(13,10)

SendMessage hOutput,%EM_REPLACESEL,%FALSE,ByVal StrPtr(b$)

END SUB

' ##########################################################################

Regards,

hutch@pbq.com.au
Posted on 2001-09-25 05:19:04 by hutch--
Thank you thank you! I have been looking on the net for days about that, but I suppose in all the wrong places.


l8a
Posted on 2001-09-25 11:33:27 by drarem