x


Tooltip with GUI.TextField

    var stringToEdit : String = "Hello World";
    function OnGUI () 
    {
    stringToEdit = GUI.TextField (Rect (10, 10, 200, 20),stringToEdit,GUIContent ("start1"));

    if(GUI.tooltip == "start1")
    {
    GUI.Label (Rect (130,835,300,40), "enter in text field");
    }
    }

BCE0023: No appropriate version of 'UnityEngine.GUI.TextField' for the argument list '(UnityEngine.Rect, String, UnityEngine.GUIContent)' was found.

when i am trying to use tool tip text field

more ▼

asked Mar 10 '11 at 06:32 PM

robert 3 gravatar image

robert 3
84 8 8 14

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

2 answers: sort voted first
var stringToEdit : String = "";

function OnGUI() 
{
    stringToEdit = GUI.TextField(Rect(10, 10, 200, 20), stringToEdit, 25);
    GUI.Label(Rect(10, 10, 300, 50), GUIContent(" ", "label1"));

    if (GUI.tooltip == "label1")
    {
       GUI.Label(Rect(210, 30, 300, 40), "enter in text field");
    }
}
more ▼

answered Mar 11 '11 at 11:48 AM

robertmathew gravatar image

robertmathew
571 35 41 51

so that others can use this code

Mar 11 '11 at 11:48 AM robertmathew
(comments are locked)
10|3000 characters needed characters left

Check the reference on GUI.TextField. None of the parameters are of type GUIContent, yet you try to supply one.

Error happens here:
stringToEdit = GUI.TextField(..., ..., GUIContent("start1"));

I guess you need to set the tooltip manually if the mouse is over the rect.

more ▼

answered Mar 10 '11 at 06:41 PM

Statement gravatar image

Statement ♦♦
20.2k 35 71 176

manually means i cannot get you can u modify this code with out error

Mar 10 '11 at 06:45 PM robert 3

robert, as I wrote, the TextField doesn't provide any means to set the tooltip since it doesn't accept any GUIContent. Normally you'd set the tooltip via the GUIContent. See the link I posted for yourself. It's a flaw in Unity or something.

Mar 10 '11 at 10:06 PM Statement ♦♦

Maybe you can cheat around it by having an empty label underneat it?

Mar 10 '11 at 10:06 PM Statement ♦♦

thanks a lot you are first to answer all my question with correct answer it is working fine

Mar 11 '11 at 11:42 AM robertmathew
(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:

x3815
x56
x41

asked: Mar 10 '11 at 06:32 PM

Seen: 1278 times

Last Updated: Mar 11 '11 at 02:51 PM