# Selection without allowing input: Label vs TextField

**URL:** <https://forum.xojo.com/t/selection-without-allowing-input-label-vs-textfield/24605>\
**Category:** General\
**Created:** [May 31, 2015, 7:53pm UTC](https://forum.xojo.com/t/selection-without-allowing-input-label-vs-textfield/24605 "2015-05-31T19:53:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Kondris](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/4491bb/32.png) [@Dave\_Kondris](https://forum.xojo.com/u/Dave_Kondris)\
**Post date:** [May 31, 2015, 7:53pm UTC](https://forum.xojo.com/t/selection-without-allowing-input-label-vs-textfield/24605/1 "2015-05-31T19:53:41Z")

</div>

Currently, I have a listbox filled with UNICODE characters. When a cell is clicked, its content (always a UNICODE character, never a normal “letter”) is added to the text property of a textarea.

I do not want to allow the user to type inside the textarea as it msut only contain these special UNICODE chars, BUT I want to allow the user to insert the cursor and delete a character if need be (rather than making him clear the text and start over).

So, I’m sort of looking for a READ-ONLY textarea which still allows left and right arrow keys and the delete (backdelete, I’m using OS X). Ideally, I want to allow all the normal user actions of selecting and deleting text. (Not sure I want to allow pasting, but am open to knowing how to allow that, too.)

What can I do? I’d thought of using a label instead and having it be selectable, but the label seems to not have the method CharPosAtXY or the properties SelStart and SelLength, so I seem to have hit a wall.

Should I subclass one or the other? Are there advantages to one over the other if subclassing is the answer?

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [May 31, 2015, 7:58pm UTC](https://forum.xojo.com/t/selection-without-allowing-input-label-vs-textfield/24605/2 "2015-05-31T19:58:11Z")

</div>

Reject the unwanted keystrokes in the KeyDown event of TextArea.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [May 31, 2015, 7:58pm UTC](https://forum.xojo.com/t/selection-without-allowing-input-label-vs-textfield/24605/3 "2015-05-31T19:58:28Z")

</div>

Return True in the KeyDown event, except for the delete keys and arrows.

---

<div class="post-metadata">

**Author:** ![Dave\_Kondris](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/4491bb/32.png) [@Dave\_Kondris](https://forum.xojo.com/u/Dave_Kondris)\
**Post date:** [May 31, 2015, 8:17pm UTC](https://forum.xojo.com/t/selection-without-allowing-input-label-vs-textfield/24605/4 "2015-05-31T20:17:20Z")

</div>

Excellent, thanks.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:46pm UTC](https://forum.xojo.com/t/selection-without-allowing-input-label-vs-textfield/24605/5 "2020-10-29T17:46:42Z")

</div>


