Don't know what to title this.

closed account (Gz64jE8b)
Need to do something like Windows' calculator where you press a button and it adds the letter/number into the edit box.

Can't use SetDlgItemText because that'd replace whatever is in the edit box (so if I pressed 1, then 2 it'd replace 1 with 2.)

Instead I want to press 1 then 2 to get 12.

Yep.
That's a simple concatenation thing. Retrieve from the text box what's in it and put it in a string variable or buffer. Append whatever you want to that. Write it back to the textbox. Personally, I'd use Get/SetWindowText().
Last edited on
closed account (Gz64jE8b)
Example?
If it's a dialog, I think that Get/SetDlgItemText make more sense than Get/SetWindowText().

Or you can append text using WM_SETSEL/WM_REPLACESEL

How To Programatically Append Text to an Edit Control
http://support.microsoft.com/kb/109550


Andy

P.S. Or it might make sense to keep track of the sum using a variable and only ever set? (Actually, this might be the only way to do things, if you want [C] and [CE] to work?)
Last edited on
Topic archived. No new replies allowed.