Editbox question
Im using the Win32 API, I've got an Editbox, a Listbox and a few buttons. The Editbox is a single lined editbox which when I click the Add button the text is put into the Listbox. I want to be able to press the return key to perform the same function as pressing the Add button would do. I've tried numerous things but nothing seems to work.
What are you doing this in (.NET, VB, Delphi, MFC etc)
normally you just add an OnKeyPress event handler and check if the Key is char(13). If it is add the textbox text to the listbox and normally clear the textbox ready for the next entry
Hope it helps
Mark
normally you just add an OnKeyPress event handler and check if the Key is char(13). If it is add the textbox text to the listbox and normally clear the textbox ready for the next entry
Hope it helps
Mark
You can subclass the edit box and catch WM_KEYUP in your custom window proc and react upon enter there. Win32 is a pain though, I would suggest something easier like c# if you want to do GUI development.
Probably the simplest thing would be to give the add button the default button style. If a control doesn't accept enter the dialog acts as if the dialogs default button was pushed.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement