Archived

This topic is now archived and is closed to further replies.

com

calling parts of my dialog of my GUI?

Recommended Posts

currently i have a dialog box for my aplication asking the user if he/she would like to search for a item or add a new one. all my edit boxes are IDC_EDIT2 all the way to 9 and i have IDOK and IDCANCEL but i dont know how to call these. for example i want to get my program to first test if the text is being entered into my find box (IDC_EDIT2) or if its being entered into the name box along with any of the commponent boxes (IDC_EDIT3-9). and then i need to test if the ok or cancel buttons are beign pressed. how do i do this?

Share this post


Link to post
Share on other sites
Well, your dialog box is a window just like any other window (come to think of it so are your controls). All you have to do is process the WM_COMMAND message that is sent to your dialog box procedure. Look up DialogProc on MSDN for all of the gritty details.

As for IDOK and IDCANCEL, their behavior can be modified in the aforementioned dialog procedure as well.

Sorry if this sounds a bit sketchy, but I''ve been pulling an all night debug session. I''m sure one of the other fine ''gamedevers'' will be happy to provide clarification if you need it.

Share this post


Link to post
Share on other sites
You can use GetDlgItemText I think for the edit boxes'' content, once you know where you want to process them.

You might consider renaming your resources to more readable names too... double click on an edit box, and change the id to something more practical. Like IDC_EDIT_FILENAME instead of IDC_EDIT1, so when you call GetDlgItemText or Send/PostMessage you can read your code easier.

If you dig around through the older projects on my website, you should find an example of using just about every dialog control somewhere, albeit poorly (if the reference isn''t helping).

Freeware development:
http://www.ruinedsoft.com/

Share this post


Link to post
Share on other sites