Re: Stop text overwrting in a edit box
Quote:
Originally Posted by
gaar321
Right okay this is starting to make sence i know how to do concatenation.
What i am coding is nothing to with a console app.
You're missing my point, and the reason you are asking endless questions on something that is so simple (and probably will be asking more basic C++ questions in the future).
The first thing you should be learning is the language. You obviously did not do that. What I showed you could be used in any application type, since it shows how you do concatenation using C++.
You are using C++, right? So what I showed you is basic C++ usage, something you will find in any C++ book. Let's take your code:
Code:
#include "stdafx.h"
#include "Calc.h"
#include <Richedit.h>
#include <string>
std::string currentEditText;
//...
case ID_B0:
Edit_SetText(Box,"0");
currentEditText += Edit_GetText(Box,"0"); // gets the text and concatenates it onto the current text.
break;
case ID_B1:
currentEditText += "1";
Edit_SetText(Box, currentEditText.c_str());
Something like this is what you should be doing. Whether this works exactly as you're describing, I don't know since I have no idea what Edit_SetText/Edit_GetText do or what they return.
Seriously, if you want to learn how to program, you don't take examples off the web and not know anything about how to logically put together your own functions/programs, and worse, not know basic C++ syntax and rules.
Regards,
Paul McKenzie
Re: Stop text overwrting in a edit box
Code:
case ID_B0:
Edit_SetText(Box,"0");
break;
case ID_B1:
Edit_SetText(Box,"1");
Okay, let's see what happens. You program a reaction to button press as setting some predefined (!) text. Every SetText call overwrites the edit box content. Entirely. Please read this twice.
To append another chunk (whatever it is, digit or something) you have to read the current edit box content to a buffer, append your chunk to that buffer and only then apply the new buffer content to edit box with SetText. Now, does this ring any bells to you? ;)
Re: Stop text overwrting in a edit box
Re: Stop text overwrting in a edit box
Re: Stop text overwrting in a edit box
Quote:
Originally Posted by
gaar321
Right okay this is starting to make sence i know how to do concatenation.
What i am coding is nothing to with a console app.
I am trying to apply 10 in a win app e.g.
What is your question? You just said that you understand concatenation, and from previous posts you imply that you understand how to populate an edit box. :confused:
Viggy
Re: Stop text overwrting in a edit box