Jump to content
  • Advertisement
Sign in to follow this  
Mazh

Win32 Question

This topic is 3715 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

I'm currently doing some Win32 programming and didn't find anything about the feature I want. I've created 3 "edit" windows to write some values into it and I'd like a tips how to calculate the 3th value automaticaly when I click the "calculate" button. So, I've 3 edit boxex, writing 2 values and want the 3th edit box show me the results into the edit box and vis-versa. I've also thought about making a menu to calculate specific values, the got valuee from the edits and click to the corresponding menu to calculate the missing value to the edit box that needs it. What I wish the most is something that could refresh my windows so this is calculating automatically. But didn't find anything via MSDN, maybe some wrong key-search but.. ^^ I'd also make it so when I hit ENTER, the blank value missing in the edit just appear up too, just another idea. If you need more informations to get it clearly feel free to ask. Thanks for any comments or future help. Cordially, Mazh Edit: How to get string to my value that are into my edit boxes? I mean, when I enter a number into my edit box, how do I retrieve the information to use it to my own? Thanks. [Edited by - Mazh on April 20, 2008 10:49:29 PM]

Share this post


Link to post
Share on other sites
Advertisement
In your WM_NOTIFY handler you can handle the EN_CHANGE notification. You can get the data from the edit controls using GetDlgItemInt() or GetDlgItemText().

Share this post


Link to post
Share on other sites
well as for adding the values of 2 edit controls, and placing it into the 3rd, try something like


there's a function that grabs the contents of an Edit, which was mentioned about, GetDlgItemInt()

int NumberOne = GetDlgItemInt(hWnd1); // get values of both edit boxes
int NumberTwo = GetDlgItemInt(hwnd2);

int total = NumberOne + NumberTwo; //add

stringStreamObject << total; //pre-initialized string stream

SetWindowText(hWnd3,stringStreamObject.str().c_str());


that would do the job, as for the pressing enter, try using a button at first

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!