Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Backspace

Author
Message
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 3rd Oct 2009 19:43
I know that this has been discussed many times. I was recently reading the chatbox thread about it but it did not come up with a solution that i needed.

I have my code, it will currently remove 1 character from my text as it is supposed to. The only problem is that when i start typing again the value immeditly goes back to my Dbentry. I am not sure how i would set this up so that i get a value with the values removed. But when i start typing it starts from where i left off. Sorry it is kind of a confusing question. Here is my code i hope you guys can help me. I dont want text highlighting or anything else. Just to remove the characters.

Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 4th Oct 2009 09:25
No one?
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 4th Oct 2009 11:04 Edited at: 4th Oct 2009 11:04
Snippet from my function library:



In that code, 'entry' is a std::string, and all of my basic types use typedefs to make them shorter, though it should be fairly obvious what they all are. In case it's not obvious you pass a string to AddEntry() and it adds the entry buffer to this string, but not directly, it goes through every character and removes one if it's a backspace or adds it if it's otherwise valid.

Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 4th Oct 2009 19:49 Edited at: 4th Oct 2009 19:54
Sorry i am very new to c++, the code you provided is amazing but perhaps you could explain it a bit more to a novice like myself.



I got it to compile and i am calling it. But how do i get the value with the backspaces removed? None of your code has a return in it? Should i simply add a return? or how would i go about this? I tried adding a return but all i got was as single charactar at a time.

Sorry i am pretty much a newb to c++.
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 6th Oct 2009 08:44
bump...
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 6th Oct 2009 09:43
The string passed to the function is a reference, so it modifies the input.

Login to post a reply

Server time is: 2024-10-01 14:24:03
Your offset time is: 2024-10-01 14:24:03