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.

Author
Message
FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 26th Apr 2010 05:41 Edited at: 26th Apr 2010 05:44
I'm having some trouble having text hide and whatnot in my textboxes. Any help is appreciated. You'll see what I mean by typing into one of the textboxes to the edge. It works once then stops.



Dev team portal Email me to join the dev team!

FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 27th Apr 2010 02:40
Any ideas? I'm stumped

Dev team portal Email me to join the dev team!

Nomad The Great
18
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 27th Apr 2010 06:17 Edited at: 27th Apr 2010 20:26
Forgive me for i'm tired and didn't completely go through your code. I tend to try to keep all my gui elements in one function, just to make it easier to code my main loop. I'll post here what i have for mine, it has no cursor | but when a textbox is active the box border turns red, delete clears text.



you should be able to just call that function in any loop and it'll self update, feel free to add as many as you want, up to 1000, it'll keep each and every string. here's what i mean:

textbox(100,100,40,5,1)

at x 100 and y 100, a textbox 40 characters wide by 5 lines high will appear. it multiples the 5 lines by the 40 characters wide to create a max string length of 200 characters. i did this because i didn't want to have to hide text that wouldn't appear plus i was just lazy lol.

feel free to use this or play around with it.

edit: check the download if you want its sort of a demo of what i've been tinkering around with and shows my textbox as well. I'm not the best programmer so please go easy on me lol

edit2: come to think of it instead of having it calculate a maximum string length and stopping, i could just have it not print to the box after the max length occurs and find a way to just have it scroll right after every character added to the string... i'm still too lazy for that tho.
FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 28th Apr 2010 01:13 Edited at: 28th Apr 2010 01:14
Well thanks for showing me that , but what you said here:

Quote: "
edit2: come to think of it instead of having it calculate a maximum string length and stopping, i could just have it not print to the box after the max length occurs and find a way to just have it scroll right after every character added to the string... i'm still too lazy for that tho.
"


Is exactly what I'm trying to do. I want them to be able to type in the textbox even when it hits the edge. Like a normal textbox. Mine works for the first character, then stops.

Dev team portal Email me to join the dev team!

Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 28th Apr 2010 01:31 Edited at: 28th Apr 2010 01:33
I've been thinking about this problem too.. I doubt I would run into it very often, for my Text RPG, but it's still one of those "what if's"

If anyone does figure out a good efficient way to implement a text entry box, that scrolls to the right with input, I would be very appreciative if they shared the code..

Especially since I will likely be having a GUI with a text entry area.

I'm going to be working with TDK's text wrapping box code, so I wonder if starting there might give some ideas? Maybe having the text entry box be two lines high and wrap additional text to the second line as it is entered?

FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 28th Apr 2010 01:32
Well, I'm really really close, and would love to share it when it's all done. My logic is just off a little apparently, with it. So when this is all said and done, I'll just share it =]

Dev team portal Email me to join the dev team!

FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 28th Apr 2010 05:55 Edited at: 28th Apr 2010 05:55
I dunno if this is any closer, but I think I've figure out what the issue is. After the first wrap with the letter, it would no longer be longer than the text box, so it would stop. Now I just have to figure out how to get the event where and key is pressed and released.



Does that seem any closer than the other? I think it is actually. The logic seems closer.

Dev team portal Email me to join the dev team!

Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 28th Apr 2010 17:02 Edited at: 28th Apr 2010 17:04
I tried it out and both boxes stopped after the first letter outside the visible bounds of the box, like before.

Conversely, I've done minor tinkering with TDK's text wrapping box, and I can get it to do wrapping, etc.. I've never been able to tweak the code, so that it'll show what's being typed in real time..

I either get stuck with a method that you have to type everything and hit Enter before it shows up, or it'll show realtime presses by one 1 character at a time before deleting the buffer - despite several placement attempts of the clear buffer command..

I don't know if you've looked at his code already, but here's a link.

http://forum.thegamecreators.com/?m=forum_view&t=122891&b=6

Maybe there will be a good solution hidden in there.

FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 29th Apr 2010 01:34 Edited at: 29th Apr 2010 05:06
Thanks Neco. I'll keep looking at his code maybe I can solve my issues from his. Currently I have this:



But I've figured out the two issues.
1)Since keystate returns true WHILE the key is being pressed it constantly word wraps until you release the key, which even if you tap the key can be more than 1 character.
2)The textboxes(x).textToShow$ doesn't add the new characters just typed to the end. FIXED THIS - Updated the code. Now its just adding multiple because of the scancode issue.
3)Edit: And now there is still a cursor left there after the first wrap.
4)Shift key(etc) adds more of previous letter

If you can figure these out, or help, it would be greatly appreciated.

Dev team portal Email me to join the dev team!

Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 29th Apr 2010 17:29
I'm happy to test things out for you, but I'm probably the LAST person you want attempting to modify any code.. I'm pretty new to DB as a language (and finding it rather troubling for basic text stuff like this, imho) and as you can see I've got my own problems, now..

CodemanV has contributed some code and ideas to TDK's existing example.. So all I can recommend is you might finding something in his additions too? (they're marked very well)

FireIndy
19
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 4th May 2010 01:22
Im really in need of this and am really stuck. If anyone can help me that would be great.

Dev team portal Email me to join the dev team!

Homey the Clown
22
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 4th May 2010 04:00
I am going to be honest, I haven't read through all of the posts but to answer your problem about text 'bleeding' off of the textbox (for lack of a better word..), have a separate variable hold the total length of the string and a static variable that holds the maximum of characters within that textbox. So textbox.width / width(in pixels) of a single character. Basically do a left$( str$, max_len ) and print that result in the textbox. the user should be able to keep typing but only see up to that one point. I haven't exactly done this before and cant say I am an expert at this, but that is my idea. I will try out your code sometime.. not sure when as this week is college finals week...


If at first you dont succeed, call it version 1.0.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th May 2010 05:31
I posted a function recently which might point you in the right direction. It's in this thread:

http://forum.thegamecreators.com/?m=forum_view&t=168739&b=7

TDK

Login to post a reply

Server time is: 2026-07-26 04:27:28
Your offset time is: 2026-07-26 04:27:28