Editable textObject
by Very Interactive Person · in Torque Game Builder · 10/18/2007 (11:42 am) · 10 replies
I want to have an editable textObject in my level. I looked trough the editor code (becuase in the editor it's possible to edit the text of a textObject), but couldn't find how its done. Can someone please point me in the right direction? Thanks.
#2
10/18/2007 (2:37 pm)
I know how to use the textObject to display texts in a level. What I don't know is how I can let the user enter text in the textOBject. Normally I do this in a GUI, but this time I really need it to be a textObject. At first I thought this wasn't possible, but then I realised its possible in the the TGB editor, and that's scripted. Did anyone do something like this already?
#3
I know the editor does it, but thats because it gets to use source code. The only way that we could access it through TorqueScript, is if there was a specific ConsoleFunction / ConsoleMethod implemented to do it. However, I don't think there is. You're best bet is to just use a GUI input box.
10/18/2007 (3:59 pm)
Yeah, um, I have a funny feeling that you're not going to be able to do this.I know the editor does it, but thats because it gets to use source code. The only way that we could access it through TorqueScript, is if there was a specific ConsoleFunction / ConsoleMethod implemented to do it. However, I don't think there is. You're best bet is to just use a GUI input box.
#4
10/18/2007 (9:43 pm)
Ward, if you really need an editable text object, you can check a keyboard input and add correspondent symbols to the TextObject.
#5
@Philip: Well, its possible in the editor, so the functionality is there I think.
10/19/2007 (12:03 am)
Is it possible to check keyboard input without binding keys? Even if I do it that way, that wouldn't give me a blinking cursor.@Philip: Well, its possible in the editor, so the functionality is there I think.
#6
There are two types of methods we use in Torque. Source methods, written into the source and Console methods, the ones that are accessable through our own script.
The only console methods that are available to us, are the ones that have been selected. Other methods, like the ability to modify t2dTextObject through user input, has not been. I could be incorrect, however.
10/19/2007 (2:26 am)
Yes, the *source* functionality is there.There are two types of methods we use in Torque. Source methods, written into the source and Console methods, the ones that are accessable through our own script.
The only console methods that are available to us, are the ones that have been selected. Other methods, like the ability to modify t2dTextObject through user input, has not been. I could be incorrect, however.
#7
You can get a blinking cursor very easy. Add and remove symbol "|" or "_" to the end of the text periodically. shedule() will help you.
10/19/2007 (5:31 am)
Ward,You can get a blinking cursor very easy. Add and remove symbol "|" or "_" to the end of the text periodically. shedule() will help you.
#8
Another downside is I have to bind all keys. Or is there another way to catch keyboard input? Any other ideas? My game is almost done, and I'm stuck again on something really stupid. I can't have the text in GUI becuase its mounted to a moving object.
10/22/2007 (2:27 pm)
If the text is centered, and you do something like this, the text will constantly move, becuase each time you add or remove the "|" character, the textwidth changes.Another downside is I have to bind all keys. Or is there another way to catch keyboard input? Any other ideas? My game is almost done, and I'm stuck again on something really stupid. I can't have the text in GUI becuase its mounted to a moving object.
#9
May be it will help you.
10/22/2007 (11:23 pm)
As far as I know there is a metodt2dSceneObject::attachGui(%guiControl, %sceneWindow, %sizeControl)wich allow to attach some GuiControl to a scene object.
May be it will help you.
#10
10/23/2007 (11:37 am)
Thanks a lot! This works indeed.
Associate Phillip O'Shea
Violent Tulip