2D Toolkit Forum

2D Toolkit => Support => Topic started by: RakeshChatra on October 11, 2013, 06:03:04 pm

Title: Clearing the text from the text input wafter sending the text
Post by: RakeshChatra on October 11, 2013, 06:03:04 pm
HI, I am trying to send the input text which i enter in the input space and sending it to the server to display the chat.. but then if i again enter the text in the text input the previous text is displaying along with the current text.. Please help me to clear the text one used..
Title: Re: Clearing the text from the text input wafter sending the text
Post by: unikronsoftware on October 11, 2013, 06:07:20 pm
How are you clearing it?
Title: Re: Clearing the text from the text input wafter sending the text
Post by: RakeshChatra on October 13, 2013, 08:30:51 am
I am setting it to null once used.. string strigtoedit = " ";
Title: Re: Clearing the text from the text input wafter sending the text
Post by: unikronsoftware on October 13, 2013, 08:38:24 am
Setting what exactly, the text mesh or the textinput?
Title: Re: Clearing the text from the text input wafter sending the text
Post by: RakeshChatra on October 13, 2013, 11:46:41 am
string stringtoedit = chatinput.text;
here chatinput is the tk2dTextMesh.. after sending the msg i am making the stringtoedit = " "; setting it to null.
Title: Re: Clearing the text from the text input wafter sending the text
Post by: unikronsoftware on October 13, 2013, 12:01:44 pm
You should set it on the tk2dUITextInput.Text. You should be reading the values from that too, if you aren't already. The text mesh simply displays the text on the textinput.
Title: Re: Clearing the text from the text input wafter sending the text
Post by: RakeshChatra on October 15, 2013, 09:33:47 am
i am not able to get it.. tk2dUITextInput.Text should be set to what ?? like i have declared chatInput as a tk2dTextMesh instead of this u want me to declare chatInput as tk2dUITextInput ??
Title: Re: Clearing the text from the text input wafter sending the text
Post by: unikronsoftware on October 15, 2013, 10:17:09 am
You're using the text input, correct? So read and assign textInput.text, don't read directly from the textmesh. The textInput updates the text on there.
Title: Re: Clearing the text from the text input wafter sending the text
Post by: RakeshChatra on October 15, 2013, 11:13:18 am
Public tk2dTextMesh chatInput;
string stringToEdit;
      if(chatInput.text!="")
      {
         
         stringToEdit   = chatInput.text;
         Debug.Log("stringToEdit.."+ stringToEdit);
         string encodedText = WWW.EscapeURL(stringToEdit);
         SendChat(encodedText);
      }

      chatInput.text = "";
      stringToEdit ="";
      chatInput.Commit();

this is my code here can you please tell me what changes should i make :)
Title: Re: Clearing the text from the text input wafter sending the text
Post by: unikronsoftware on October 15, 2013, 11:15:47 am
Surely that chat INput text mesh is linked to the tk2dUITextInput?
Basically, do what i've been telling you in the past 2 posts.
use tk2dUITextInput chatInput instead of the textmesh.
Title: Re: Clearing the text from the text input wafter sending the text
Post by: RakeshChatra on October 15, 2013, 01:24:01 pm
thank you that solved my problem...:):) and sorry for repeatedly asking the samething..