ID:263809
 
Code:
usr.name=nameWindow.input1


Problem description:
I thought this would work, but it doesn't. How would I go about obtaining information from an input box?
You have to give the input a default command. In the interface editor, select the input and click Edit. Then go to the Options tab and give the input a default command. For this you might have something like:

mob/verb/SetName(t as text|null)
set hidden = TRUE
if(!t) return
usr.name = t


Then just set the default command to SetName. Whn the player enters a name and presses Enter, this command will pass what they type as the variable t and set the usr's name equal to it.
In response to Xooxer
Hehe, thanks! Is there a way to set a tab order or something similar? I'm trying to make a character creation window, and if the player presses enter, whatever they entered gets submitted. Any way to avoid that without using web forms?
In response to Dead_Demon
Yep. Each item you add to the window gets the next tab. So, if you added the name input before you added the description input, the name input would be the first in the tab order, and the description input would be the second.

Simply select the input you want, and it's tab order number will be shown on the New Window screen to the left of the window you're working on. It will say something like:

<code>4th in tab order</code>

To change the tab order, select the input and click the Layout Menu in the New Window window. This brings up a huge list of layout options you can fiddle with, but the two commands we want are towards the bottom. They're called 'Move ahead in tab order' and 'Move back in tab order'.

Now this may seem a bit unintuitive, but to get that 4th tab to the first tab place, you have to use 'Move back' 3 times. To get it into the 5th tab spot, you'd use 'Move ahead' once.

BYOND 4.0 interface elements can do almost anything a standard HTML form can do.

~X
In response to Dead_Demon
A better way to do it(if it is the only one or something) for input boxes like for chat and stuff would be to set the input control's default parameter to true. Default controls always get it automatically.
In response to Kaiochao2536
For a basic input on the main window, sure. But I think he's trying to make a settings window of some sort with multiple controls like an HTML form.

If he really wants an HTMl-like form interface, though. Default command may not be enough for the players. I'd recommend adding a button to the form that says Update or Submit, or something of that nature. Have that set to a default command called 'UpdateSettings' or something, and have that command winget() all the text from each input on the form and pass that text to the form's default command.

That way, if a player forgets to hit Enter after each input they change, they can still press the Update button and have everything updated at once. It's a lot more intuitive for the players, since they're used to HTMl forms that work this way.

Maybe I'll write a short demo about this, if no one has already.

~X
In response to Xooxer
I think a recent addition was the "text" parameter for input controls. It contains... the text in the input box, I believe. That's probably what he's looking for, too.

A button to winget() the "text" paramater for the input controls, and submitting them like a form.
In response to Kaiochao2536
Whis is exactly what I just described. :P
In response to Xooxer
Just telling you about the special parameter if you didn't know about it.
In response to Kaiochao2536
Not only do I know about it, I was most likely one of the main proponents of it's inclusion. I help beta test the releases before they go public, so while I may not be 100% familiar with everything in the new 4.0 version, I do know quite a bit about the new features. It's kinda our duty as beta testers to try and break the new features and fixes before the public has a chance to.