Jump to content
  • Advertisement
Sign in to follow this  
Dookie

Disabling a dialogbox text item?

This topic is 5035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, it's me again. Thanks for all the help you've given me in the past, you guys ROCK! But I gots another easy question for ya... I have a dialog box working, and it has text input blanks (edit controls) and check boxes in it. What I want is to grey out or make invisible some edit controls when certain text boxes are checked. I've already figured out how to do something as soon as my checkbox is checked (under the 'WM_COMMAND:' case in my dialogbox message processing function), and I know how to determine whether the box is checked, but I don't know what command I'd use to actually disable the edit controls! I think I can do it if I knew the commands to actually grey out or make invisible an edit control... For simplicity's sake, my checkbox has the id 'IDC_INVINCIBLE' and the edit control I want affected has the id 'IDC_QUADHEALTH'. I currently know when 'IDC_INVINCIBLE' is actually checked or not checked, but I don't know what command I'd use to actually disable or make invisible the edit control 'IDC_QUADHEALTH'. Would somebody show me what command I'd use (and also show its usage) to disable or enable an edit control? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Like this?


HWND hWndEdit = GetDlgItem( hWndDlg, IDC_QUADHEALTH );
EnableWindow( hWndEdit, FALSE );



First retrieve the window handle to the edit box using GetDlgItem and then
disable the window with EnableWindow.

Share this post


Link to post
Share on other sites
Thanks for the reply and explanation, T1mb0. That's exactly what I needed, and it works perfectly! I'm still trying to get the hang of Windows programming, as I still don't quite understand some of the concepts (an edit blank can have a window handler?). But it's getting easier as I learn more about it, and this forum and all the guys and gals here make it a lot easier to learn!

And thanks for the link to 'EM_SETREADONLY', JimPrice. I'll check it out and see what it does! I played around with that 'SendMessage()' function earlier today, but didn't know that I could turn my 'IDC_QUADHEALTH' id into a windows handler... I was trying to send my control id to that function while using the dialogbox's window handler, and, well, it didn't work... Doh! But I bet it'll work by sending hWndEdit to SendMessage() when hWndEdit = GetDlgItem( hWndDlg, IDC_QUADHEALTH )!

Thanks again for the help, I really appreciate it!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!