Hello Guest

Author Topic: Clearing the text from the text input wafter sending the text  (Read 6737 times)

RakeshChatra

  • Newbie
  • *
  • Posts: 33
    • View Profile
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..

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #1 on: October 11, 2013, 06:07:20 pm »
How are you clearing it?

RakeshChatra

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #2 on: October 13, 2013, 08:30:51 am »
I am setting it to null once used.. string strigtoedit = " ";

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #3 on: October 13, 2013, 08:38:24 am »
Setting what exactly, the text mesh or the textinput?

RakeshChatra

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #4 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.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #5 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.

RakeshChatra

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #6 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 ??

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #7 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.

RakeshChatra

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #8 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 :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #9 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.

RakeshChatra

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Clearing the text from the text input wafter sending the text
« Reply #10 on: October 15, 2013, 01:24:01 pm »
thank you that solved my problem...:):) and sorry for repeatedly asking the samething..