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 / Textbox Class Yay!

Author
Message
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 2nd Jun 2009 22:27 Edited at: 3rd Jun 2009 09:13
Here is my class & it's constructors for some textboxes:


I'm posting it because, well, it won't work properly.
All you have to do to use it is, call the Make constructor once & the Do constructor every frame.


What Works:
Yes you can create 1 textbox,
If you click in it and type text appears,
If you click out of it and type no text appears,
If you click out of it then click back in it you continue typing where you left off,

Issues:
Try and make more than 1 all but the first have problems
(thats the only problem)


Whats going on here? It shouldnt be doing this bad error poo poo stuff >.<

ABXG
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Canada
Posted: 3rd Jun 2009 02:36 Edited at: 3rd Jun 2009 02:41
dbEntry doesn't filter out escape characters, such as Enter, Backspace, Tab, etc. You manually have to remove these items from your stream to make it work properly. I did this by using a series of loops that would search my entry every frame and modify my output based on the escape characters found.



------------------------------------
Currently 1500+ lines of code into an "over-the-shoulder" action RPG with combat based on rag-doll physics.
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 3rd Jun 2009 08:22 Edited at: 3rd Jun 2009 09:14
Yes, I am eventually going to do that very thing, it's just my class, it wont let you use more than 1 textbox, I don't see why this is.

Edit: I updated the code in the first post, only one problem now, but a big one

ABXG
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Canada
Posted: 3rd Jun 2009 09:52
It's probably because even across multiple instances of a text box, there is only one instance of dbEntry.

You may want to look into a system of using a character vector and the commands for getting the ASCII code of the key being pressed. You would than expand or delete this array as needed, it would also be a lot easier to deal with escape characters.

------------------------------------
Currently 1500+ lines of code into an "over-the-shoulder" action RPG with combat based on rag-doll physics.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 3rd Jun 2009 16:10
HMMM!!!! I am doing a similar type of project at the moment.
The only difference is that my GUI controls are auto scaling so that no matter what screen resolution has been selected, the controls will be in the correct screen proportion.

Anyway, back to your problem .... it had me stumped for a few minutes.


As soon as you pass through the textbod:o() function for the first instance of the text box, it will clear out the data from the entry buffer, no matter whether you have used this data or whether you want to use this data for a following instance.

You only want to empty the entry buffer IF the data was actually used by that text box.

kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 3rd Jun 2009 17:50
OH YES! I tried your idea and it worked, thank you! =D

Login to post a reply

Server time is: 2024-11-25 10:40:58
Your offset time is: 2024-11-25 10:40:58