# 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:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Moore](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@Nick\_Moore](https://forum.inductiveautomation.com/u/Nick_Moore)\
**Post date:** [September 20, 2024, 8:31pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/1 "2024-09-20T20:31:20Z")

</div>

I'm working on building out a CMMS with Vision Windows for my team and as you might be able to tell from the photo, the way to mention someone is a little......clunky. Clicking a username in the list adds the username to a label component below the text area component where the comment goes. It gets the job done, but I need to start planning for MVP+.

I'd like to implement what most team-oriented applications do with mentions and utilize a dynamic popup menu when @ is pressed, while having it drill down as more keys are pressed.

I thought about exploring a keyReleased trigger in the text area component where @ would open a window that would essentially be a list component or something similar, but I haven't explored that option yet (and I don't particularly love the list component).

Anyone tried to tackle this before?

Sidenote: Before I even thought about creating a comments function, I looked up trying to integrate Microsoft Teams on this forum and unless I missed an article, it didn't look like a great option. So this is what I came up with. Any critiques/advice is 100% encouraged.

 ![Screenshot 2024-09-20 160900](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/2/22d2309e35d711d888a7eb4c512bfb4c32c50b71.png)

---

<div class="post-metadata">

**Author:** ![Hari\_GB](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hari\_GB](https://forum.inductiveautomation.com/u/Hari_GB)\
**Post date:** [April 4, 2025, 10:47am UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/2 "2025-04-04T10:47:58Z")

</div>

Do have the similar problem statement, Are there any nice solutions ?

---

<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)

---

<div class="post-metadata">

**Author:** ![Hari\_GB](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hari\_GB](https://forum.inductiveautomation.com/u/Hari_GB)\
**Post date:** [April 9, 2025, 4:45pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/4 "2025-04-09T16:45:02Z")

</div>

Wonderful solution !! @justinedwards.jle Request you to make it as Ignition exchange contribution.

---

<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, 6:56pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/5 "2025-04-09T18:56:52Z")

</div>

> [@Hari\_GB](#):
>
> Request you to make it as Ignition exchange contribution.

Go for it. Finish developing that thing into whatever it's supposed to be, and let us know when we can download it.

---

<div class="post-metadata">

**Author:** ![Hari\_GB](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hari\_GB](https://forum.inductiveautomation.com/u/Hari_GB)\
**Post date:** [May 7, 2025, 12:32pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/6 "2025-05-07T12:32:38Z")

</div>

@ mention, the solution you gave for Vision worked great! I'm now looking for something similar in Perspective—any way we can do that too?

---

<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:** [May 7, 2025, 1:23pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/7 "2025-05-07T13:23:47Z")

</div>

I'm sure there is, but unfortunately, the right people probably aren't going to see it in this post since it's tagged Vision. I recommend creating a separate post and tagging it Perspective, so the Perspective gurus will notice the question and give you a proper answer.

---

<div class="post-metadata">

**Author:** ![Hari\_GB](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hari\_GB](https://forum.inductiveautomation.com/u/Hari_GB)\
**Post date:** [May 7, 2025, 1:32pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/8 "2025-05-07T13:32:41Z")

</div>

Thanks @justinedwards.jle

Here's the post link asking for similar feature in perspective.

> [@Creating a Mentions Function for Perspective text area/text field](https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977):
>
> This discussion has a nice solution for @mention feature for vision, I'm now looking for something similar in Perspective—any way we can do that too?
