Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: skullthug on March 23, 2015, 04:01:01 PM

Title: How to make text in UILabel selectable (but not input)?
Post by: skullthug on March 23, 2015, 04:01:01 PM
Hi there. Thanks always for keeping NGUI healthy and running.
I'm working on a project that is implementing a simple chat system, and I was wondering if there's a simple or built-in way to make text selectable for users to Ctrl+C copy (from their chat logs).
Selecting text works fine with UIInput, but we obviously don't want users to be able to edit their chat history.

Cheers.
Title: Re: How to make text in UILabel selectable (but not input)?
Post by: ArenMook on March 24, 2015, 10:35:53 AM
CTRL+C / CTRL+V functionality is already built into the UIInput, but if I understand correctly you're asking about a label? There is no selecting a label. You have two alternatives. Simply react to a user click on the label and set NGUITools.clipboard, or use the UIInput but set its validation to a custom function that will reset the text every time the user tries to type.
Title: Re: How to make text in UILabel selectable (but not input)?
Post by: skullthug on March 24, 2015, 12:53:25 PM
OK. I suspected as much. Thanks for replying.