Sign in to follow this  
simon10k

Editbox question

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
I'm just using C++ and Win32, not visual development. I've just nailed it, sub classing the edit -thanks guys, and doho.

[Edited by - simon10k on June 12, 2005 10:56:31 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this