Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 There's no KEY_ button for the spacebar?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
harishmabish




PostPosted: Sat Mar 29, 2008 4:23 pm   Post subject: There's no KEY_ button for the spacebar?

Why?!!!!!
Sponsor
Sponsor
Sponsor
sponsor
richcash




PostPosted: Sat Mar 29, 2008 4:31 pm   Post subject: Re: There's no KEY_ button for the spacebar?

Probably because you can just represent it by this :
code:
' '
or chr (32)
harishmabish




PostPosted: Sat Mar 29, 2008 5:24 pm   Post subject: RE:There\'s no KEY_ button for the spacebar?

im a noob, im sorry
DaveAngus




PostPosted: Sun Mar 30, 2008 8:54 pm   Post subject: RE:There\'s no KEY_ button for the spacebar?

Haha everyone has to learn it at some point.
The_Bean




PostPosted: Sun Mar 30, 2008 9:28 pm   Post subject: Re: There's no KEY_ button for the spacebar?

if you want to you can add it in for yourself

just go to
C:\Program Files\Turing\Support\predefs\Keyboard.tu
or where ever you have your turing program files

right after
const KEY_CTRL_UNDERSCORE : char := chr (31)
you need to add in
const KEY_SPACE : char := chr (32)

then you can use KEY_SPACE as it after you save the .tu file

Turing:

var chars :array char of boolean
loop
   Input.KeyDown(chars)
   exit when chars(KEY_SPACE)
end loop
Boiq




PostPosted: Mon Sep 29, 2008 7:19 am   Post subject: Re: There's no KEY_ button for the spacebar?

The_Bean @ Sun Mar 30, 2008 9:28 pm wrote:
if you want to you can add it in for yourself

just go to
C:\Program Files\Turing\Support\predefs\Keyboard.tu
or where ever you have your turing program files

right after
const KEY_CTRL_UNDERSCORE : char := chr (31)
you need to add in
const KEY_SPACE : char := chr (32)

then you can use KEY_SPACE as it after you save the .tu file

Turing:

var chars :array char of boolean
loop
   Input.KeyDown(chars)
   exit when chars(KEY_SPACE)
end loop


True, but if you submit a file to others people will only be able to run it properly if they made that adjustment too, otherwise there spacebar would not function for anything.
SNIPERDUDE




PostPosted: Mon Sep 29, 2008 10:53 am   Post subject: Re: There's no KEY_ button for the spacebar?

The_Bean @ Sun Mar 30, 2008 9:28 pm wrote:
True, but if you submit a file to others people will only be able to run it properly if they made that adjustment too, otherwise there spacebar would not function for anything.


That's only if you're submitting the code. Compiling it should be fine.
I've made the same adjustment a good while back.
Dan




PostPosted: Mon Sep 29, 2008 12:43 pm   Post subject: RE:There\'s no KEY_ button for the spacebar?

Editing the standard libarys for a langue is never a good idea (unless you plan on making a new version of them and realseing them).

It would make more sence to make your own libary of functions, modules and constnets you find usefull and disbtruit that with your code.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Sponsor
Sponsor
Sponsor
sponsor
Ktomislav




PostPosted: Mon Sep 29, 2008 4:46 pm   Post subject: Re: There's no KEY_ button for the spacebar?

code:

var chars :array char of boolean
loop
   Input.KeyDown(chars)
   exit when chars(' ')
end loop
S_Grimm




PostPosted: Tue Sep 30, 2008 10:17 am   Post subject: RE:There\'s no KEY_ button for the spacebar?

Ktomislav has got the easiest way. there is no editing of libraries, and Dan, not all these people know how to create a library and distribute it.
Clayton




PostPosted: Tue Sep 30, 2008 11:04 am   Post subject: RE:There\'s no KEY_ button for the spacebar?

Turing:

unit
module Foo
    export Bar

    function Bar (baz : string)
        return baz
    end Bar
end Foo


Then just save it as a .tu file and whenever you use that module with any program you wish to share as source, simply include that file with the rest of your code. Simple, really.
SNIPERDUDE




PostPosted: Tue Sep 30, 2008 3:25 pm   Post subject: RE:There\'s no KEY_ button for the spacebar?

Like my GUI as a perfect example.
The_Bean




PostPosted: Tue Sep 30, 2008 4:57 pm   Post subject: Re: There's no KEY_ button for the spacebar?

The reason behind it wasn't to have him mess up his Keyboard.tu file, he was just asking why there wasn't so I showed him to add it in if he wanted.

I also have my own .tu file with stuff like SetAngle and NthRoot
But I added it to the Predefs.lst in the support folder and put it with the others so i don't have to import it every time.
Clayton




PostPosted: Tue Sep 30, 2008 4:59 pm   Post subject: RE:There\'s no KEY_ button for the spacebar?

As Dan pointed out, modifying the pre-defined files that come with the IDE is a very poor idea, unless you are creating your own version that you plan to redistribute at large. Sure, having your own personal Predefs list is good and all, but what happens when you want to distribute your code, and forget to add that import in your program?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: