# Creating a Mentions Function in within Comments Functionality (CMMS Project)

**URL:** <https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257>\
**Category:** Ignition\
**Tags:** ignition81, python, vision, scripting\
**Created:** [September 20, 2024, 8:31pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257 "2024-09-20T20:31:20Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [April 9, 2025, 12:55pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/3 "2025-04-09T12:55:47Z")

</div>

> [@Nick\_Moore](#):
>
> essentially be a list component

> [@Hari\_GB](#):
>
> Are there any nice solutions

I don't imagine that a moving a list component around is the correct choice here, but it could probably be done effectively with a simple popup menu.

**Example:**  
First, add a dataset custom property to the text area and populate it in some way, so it has a column called `username`.

Then, use the following script on the text area's `mousePressed` event to generate the popup when the '@' key is pressed:

```python
if event.shiftDown and event.keyCode == event.VK_2:
	from java.awt.event import MouseEvent
	userData = event.source.userData
	userNames = list(userData.getColumnAsList(userData.getColumnIndex('username')))
	innerTextArea = event.source.viewport.view
	characterBounds = innerTextArea.modelToView2D(innerTextArea.caretPosition)
	mouseEvent = MouseEvent(
		innerTextArea,
		MouseEvent.MOUSE_CLICKED,
		system.date.toMillis(system.date.now()),
		0,
		int(characterBounds.x),
		int(characterBounds.y),
		1,
		False)
	
	def insertName(name):
		return lambda typeName: innerTextArea.insert(name, innerTextArea.caretPosition)
	
	menu = system.gui.createPopupMenu(userNames, [insertName(name) for name in userNames])
	menu.show(mouseEvent, int(characterBounds.x), int(characterBounds.y))

```

**Result:**  
 ![atFunctionDemo](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/b/7bbcefdc52282ed02bdd4a0cf549eadd0eac9a73.gif)

---

_[View the full topic](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257)._
