Computer Science Canada Help with typing problem |
Author: | SNIPERDUDE [ Mon Jun 02, 2008 11:15 am ] | ||
Post subject: | Help with typing problem | ||
this has been moved from my other thread... Still trying to figure out the typing problem for textboxes. The problem explains itself when you run it...
any help to get this typing problem smoothed out would be greatly appreciated. |
Author: | apomb [ Mon Jun 02, 2008 12:31 pm ] |
Post subject: | RE:Help with typing problem |
I'm unable to run Turing code on my computer, so in order for myself to see this error, please specify exactly what is happening. |
Author: | SNIPERDUDE [ Mon Jun 02, 2008 2:47 pm ] |
Post subject: | RE:Help with typing problem |
I am trying to create it so I am able to type normally and have the text come up (as if you were typing in a text box). But the problem is that when I try, it ends up either becoming too sensitive (you tap the key and two or three characters will be added to the string) or lacking in any sensitivity (you would have to press the key two times maybe to get it to add that character). I want it to be able to be sensitive only to every speed of typing, but I just can't seem to get it. btw, why can't you run turing on your comp? |
Author: | apomb [ Mon Jun 02, 2008 2:56 pm ] | ||
Post subject: | Re: Help with typing problem | ||
maybe im missing something, but wouldnt entering text be as simple as getche(chr) whats with all this get permit?
All of these extra qualifications are probably sending too many input.keydown() processes to your program, therefore not accepting the input as valid. My sugestion is to try using a more direct way of getting characters from the keyboard. And its because I dont run windows. ![]() |
Author: | SNIPERDUDE [ Mon Jun 02, 2008 2:59 pm ] |
Post subject: | RE:Help with typing problem |
what are you running? Getche? ...checking |
Author: | apomb [ Mon Jun 02, 2008 3:01 pm ] |
Post subject: | RE:Help with typing problem |
Linux on Desktop and MacOSX on laptop, but thats beside the point... I remember getche() from when i first was introduced to strings in Turing. it echos whatever character is in the brackets out to the screen. (or textbox, in your case) |
Author: | richcash [ Mon Jun 02, 2008 3:23 pm ] | ||
Post subject: | Re: Help with typing problem | ||
I agree with CompWiz, you should just use getch. Creating your own function with KeyDown will take more effort and A LOT more memory from the computer. You can also use getchar which is the function version of getch and requires no extra variable. The general idea :
|
Author: | apomb [ Mon Jun 02, 2008 3:25 pm ] |
Post subject: | Re: Help with typing problem |
richcash @ Mon Jun 02, 2008 3:23 pm wrote: I agree with CompWiz, you should just use getch. Creating your own function with KeyDown will take more effort and A LOT more memory from the computer.
who is this Compwiz you're talking about? ![]() but yes, that is basically what im saying. and im hoping you're a bit more familiar with Turing than i am. |
Author: | Insectoid [ Mon Jun 02, 2008 4:38 pm ] |
Post subject: | RE:Help with typing problem |
There is also an error with your string catenation becoming too long. I suppose if you cut off the string and start a new one after a space, it would work better. lol, one of my friends is trying to do a typing program with Input.KeyDown. I told him, "Good luck. It won't work." |
Author: | richcash [ Mon Jun 02, 2008 4:46 pm ] | ||
Post subject: | Re: Help with typing problem | ||
Also, hasch and Input.KeyDown do not work together unless Input.KeyDown comes after hasch. This does not produce the desired effect.
insectoid wrote: There is also an error with your string catenation becoming too long. I suppose if you cut off the string and start a new one after a space, it would work better. lol, one of my friends is trying to do a typing program with Input.KeyDown. I told him, "Good luck. It won't work." There's no point to doing it. Instead of using a char variable (1 byte) you use a char (256 elements) array of boolean (and according to a recent compsci tutorial each boolean takes up 1 byte for some reason). And also you'll probably end up looping through the entire (or part of the) array to check which key was pressed, making it much less efficient. apomb wrote: who is this Compwiz you're talking about? ![]() ![]() |
Author: | SNIPERDUDE [ Tue Jun 03, 2008 6:38 am ] |
Post subject: | RE:Help with typing problem |
anywho, getch is pretty much what I want. Is there any way to do this without the pause? Is there a way of not using a process? |
Author: | Insectoid [ Tue Jun 03, 2008 8:04 am ] |
Post subject: | RE:Help with typing problem |
Never use processes, they are a curse brought on to us by holtsoft. Use procedures, they are a very slightly flawed gift from god. Oops, you are using procedures. There is a difference between the two. Just out of curiosity, what does 'hasch' do? |
Author: | Tallguy [ Tue Jun 03, 2008 8:21 am ] |
Post subject: | RE:Help with typing problem |
'hasch' = has charector aka does the user push any key, it checks if a key has been pushed |
Author: | apomb [ Tue Jun 03, 2008 8:22 am ] |
Post subject: | RE:Help with typing problem |
i believe it detects whether any key is pressed. |
Author: | Tallguy [ Tue Jun 03, 2008 8:23 am ] |
Post subject: | RE:Help with typing problem |
basically yes |
Author: | SNIPERDUDE [ Tue Jun 03, 2008 9:59 am ] |
Post subject: | RE:Help with typing problem |
sooo... using getch still brings up a small prob. I don't want for my entire programme to stop to wait for an input. Any way around this? |
Author: | apomb [ Tue Jun 03, 2008 10:00 am ] |
Post subject: | RE:Help with typing problem |
getche! with an e. how exactly are you going to input if your program doesnt wait for input? |
Author: | SNIPERDUDE [ Tue Jun 03, 2008 1:00 pm ] |
Post subject: | RE:Help with typing problem |
I'm using an older turing (the new one doesn't complie right), and it says it's getch. Besides the point. Anywho I didn't want the pause because I am making more graphic based programme than text. I want the text thing so I can create my own inputboxes or text fields. I may have to end up using a process ![]() |
Author: | apomb [ Tue Jun 03, 2008 1:02 pm ] |
Post subject: | RE:Help with typing problem |
getch and getche() are completely different... however, if you dont want your program to halt every time that code runs, make a conditional statement that only runs the input code when you want it to... |
Author: | SNIPERDUDE [ Tue Jun 03, 2008 1:22 pm ] |
Post subject: | RE:Help with typing problem |
hmmm, I did implement that, but it won't be able to run anything in the back at the same time... So as long as nobody has any background animations it would work fine. by the way - what is the difference between ch := getch and getche(ch) (I believe that's how it works...)? |
Author: | apomb [ Tue Jun 03, 2008 1:29 pm ] |
Post subject: | RE:Help with typing problem |
getche always outputs to the screen... though im not 100% sure of the real difference between them, i do rememeber that getche() is a better one to use. |
Author: | SNIPERDUDE [ Tue Jun 03, 2008 1:37 pm ] |
Post subject: | RE:Help with typing problem |
not really sure I even want to output it to the screen. Anywho, getch outputs it to the screen as well. I have checked out the help manual (F10) and my guess is they got rid of getche. The only one I came across was getch. I looked on 4.1 and 4.0.1... not sure why though |
Author: | apomb [ Tue Jun 03, 2008 1:41 pm ] |
Post subject: | RE:Help with typing problem |
okay then, what do you need to check for input from the keyboard for then? |
Author: | richcash [ Tue Jun 03, 2008 3:44 pm ] | ||
Post subject: | Re: Help with typing problem | ||
What do you mean the whole program pauses?
If you put that in your loop the program won't pause. It will check for a key being pressed and if there isn't one it will move on. I see no need for a process and if I remember correctly processes are a bad mix with keyboard input. And the above does not directly output to the screen, it stores the last character pressed in the ch variable. If you use Font.Draw instead of put you can easily have a background image or manipulate the font or anything else you can imagine for a textbox. |
Author: | apomb [ Tue Jun 03, 2008 3:51 pm ] | ||
Post subject: | Re: Help with typing problem | ||
Ah theres the correct use of getch. thats exactly right. so therefore
would not only store the keystroke in ch, it would output to the screen. |
Author: | SNIPERDUDE [ Wed Jun 04, 2008 6:52 am ] |
Post subject: | RE:Help with typing problem |
Hmmm, I like the hasch check idea... and apomb, I still can't find getche. Gonna use getch. |
Author: | apomb [ Wed Jun 04, 2008 8:45 am ] |
Post subject: | RE:Help with typing problem |
it all depends on what you want the input from the keyboard to do really. if getch fits your application, perfect. |
Author: | SNIPERDUDE [ Wed Jun 04, 2008 9:12 am ] |
Post subject: | RE:Help with typing problem |
well, it works... provided I put "nocursor" in the setscreen. thanks for the help guys. Now I can finally move forward in my GUI, and finally submit it (this version at least) |
Author: | jeffgreco13 [ Wed Jun 04, 2008 10:02 am ] | ||
Post subject: | Re: Help with typing problem | ||
make sure you declare your getch variable properly too.
or something along those lines, look into it. |
Author: | SNIPERDUDE [ Wed Jun 04, 2008 2:13 pm ] |
Post subject: | RE:Help with typing problem |
I know, always do (well, not in some of my older programmes). |
Author: | Insectoid [ Thu Jun 05, 2008 8:38 pm ] |
Post subject: | RE:Help with typing problem |
Oh, thank you. So, it's like an Input.Pause that remebers what key you pressed...and doesn't halt the program... |
Author: | SNIPERDUDE [ Fri Jun 06, 2008 6:37 am ] |
Post subject: | RE:Help with typing problem |
yea, pretty cool - wished I thought of that. I got it woking, and learned something in the process... DON'T use hasch and Input.KeyDown in the same area - they cancel each other out. Antwho, just finishing up the code for it, then gonna clean it up a bit and submit. |