-
October 25th, 2009, 12:25 PM
#1
Edit box
how do i get content into a edit box
I have a button and when i press it, i want to calulate 5 + 5, and it 10 goes into the edit box.
in MVC++, I would use UPDATEDATE(FALSE), UPDATEDATA();
.....
if(HIWORD(wParam) == BN_CLICKED) <---under that code.....is where the code i need help with
thank you
-
October 25th, 2009, 12:54 PM
#2
Re: Edit box
Ok
i got this code so far
Code:
case IDB_BUTTON:{
if(HIWORD(wParam) == BN_CLICKED){
SetWindowText(hEdit, "MyTExt");
}
}
break;
when i click the button, it sets the edit box to MYTEXT...but how do i calculate something ..
say i have to edit boxes. i put 2 in the first edit box, and i add the value 10 to it in the code..and it comes out to the second edit box as 12..
thank you
-
October 26th, 2009, 06:33 AM
#3
Re: Edit box
Originally Posted by acce55
when i click the button, it sets the edit box to MYTEXT...but how do i calculate something ..
say i have to edit boxes. i put 2 in the first edit box, and i add the value 10 to it in the code..and it comes out to the second edit box as 12..
thank you
This isn't really WinAPI specific (except the edit boxes).
To get information out of an edit control, look at GetWindowText() on MSDN. If it's in a dialog, you can also look at GetDlgItemText()/GetDlgItemInt().
If you need to perform operations on the variables (like adding, etc.), do that in your program with variables.
-
November 4th, 2009, 01:43 AM
#4
Re: Edit box
Use n= atof (MyText);
to convert MyText into an integer
n=n+10;
then
sprintf (MyText, "%.2f", n);
or whatever format you like
then
SetWindowText(hEdit, "MyTExt");
hope this helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|