x


How I can make a string equal to a textfield?

I have a TextField which I want to write something on it, and that can be copied what you wrote in a string.Please help me.

thanks in advance

more ▼

asked Aug 22 '10 at 03:13 AM

Uriel_96 gravatar image

Uriel_96
930 60 70 81

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

you should do somthing like this:

var stringToEdit = "Hello World";
var finalString : String;
function OnGUI () {
    // Make a text field that modifies stringToEdit.
    stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
    if (GUI.Button(Rect(0,0,50,50),"CopyText"))
       finalString = stringToEdit;

}
more ▼

answered Aug 22 '10 at 07:22 AM

AliAzin gravatar image

AliAzin
2.5k 41 56 78

I did what you told me and gives me the error: The name 'string' does not denote a valid type. Did you mean 'System.Globalization.StringInfo' ?

Aug 22 '10 at 02:43 PM Uriel_96

Sorry, I should write "String" instead of "string"

Aug 23 '10 at 06:33 AM AliAzin
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3669
x418
x149
x52

asked: Aug 22 '10 at 03:13 AM

Seen: 1510 times

Last Updated: Aug 22 '10 at 03:13 AM