detect label click or custom keyboard

Hi there

I'm trying to display a custom keyboard on my iphone/android app.

Since I can't use the iphone built-in keyboard, I thought the best way was to display a label like this: GUILayout.Label("my textfield content", "textfield");

So it does look like a textfield but it's actually a label.

The problem now is... how do I display my own keyboard when this label is clicked? Any other better way to achieve this?

Regards, Joaquin

You should look into GUILayoutUtility.GetLastRect() function for getting the rect of the label.


GUILayout.Label("my textfield content", "textfield");
if (GUILayoutUtility.GetLastRect().Contains(Event.current.mouseposition) && Input.GetMouseButtonDown(0))
// Do label click action here

Rasmus's answer is correct and in that way you could check for a click on a label but why don't you use a button that is styled like a label. just set it's style in your skin in the way you want. even you can create a custom style and use it only for those label like buttons.

you probably would like check following forum posts with custom on-screen keyboard for iphone :