# Passing a Button or Button Bar Object Name

**URL:** <https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944>\
**Category:** Questions\
**Tags:** button, object-name, button-bar\
**Created:** [June 10, 2022, 2:32pm UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944 "2022-06-10T14:32:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdbd](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/bdbd/32/620_2.png) [@bdbd](https://the.fmsoup.org/u/bdbd)\
**Post date:** [June 10, 2022, 2:32pm UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944/1 "2022-06-10T14:32:00Z")

</div>

Has anyone figured out how to get the object name of a button when it is clicked or when its associated script runs?

---

<div class="post-metadata">

**Author:** ![samfmp](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samfmp](https://the.fmsoup.org/u/samfmp)\
**Post date:** [June 10, 2022, 2:50pm UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944/2 "2022-06-10T14:50:23Z")

</div>

Hi, have you try the following method?

[https://community.claris.com/en/s/question/0D50H00007iq5G3SAI/get-object-name-after-clicking-on-a-button-instead-of-entering-the-field](https://community.claris.com/en/s/question/0D50H00007iq5G3SAI/get-object-name-after-clicking-on-a-button-instead-of-entering-the-field)

---

<div class="post-metadata">

**Author:** ![bdbd](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/bdbd/32/620_2.png) [@bdbd](https://the.fmsoup.org/u/bdbd)\
**Post date:** [June 10, 2022, 3:23pm UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944/3 "2022-06-10T15:23:08Z")

</div>

Roundabout way but it works. Thanks!

---

<div class="post-metadata">

**Author:** ![Malcolm](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/malcolm/32/196_2.png) [@Malcolm](https://the.fmsoup.org/u/Malcolm)\
**Post date:** [June 11, 2022, 7:04am UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944/4 "2022-06-11T07:04:42Z")

</div>

You would think that the button would be accessible via Get(ActiveLayoutObjectName) but that function returns empty. It's an annoying side-effect of the need to retain state within the layout, such as the position of the cursor in a field, when a button is clicked.

Claris could help by providing us with some more tools for interacting with buttons and panels.

---

<div class="post-metadata">

**Author:** ![Kirk](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/kirk/32/2197_2.png) [@Kirk](https://the.fmsoup.org/u/Kirk)\
**Post date:** [June 11, 2022, 11:52pm UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944/5 "2022-06-11T23:52:04Z")

</div>

I submitted an idea a few years back. As every object in FM has a unique, never to be reused ID, each object should have an associated default object name. This would save the step of manually having to name objects in order to reference them. The ability to custom change the object default name would still be retained so the cryptic object-name-by-reference-ID could be changed for readability, but having a default unique name would be useful.

And as FM already has unique IDs for every object today, the transition might be light lifting.

---

<div class="post-metadata">

**Author:** ![planteg](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/planteg/32/627_2.png) [@planteg](https://the.fmsoup.org/u/planteg)\
**Post date:** [June 12, 2022, 3:25am UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944/6 "2022-06-12T03:25:34Z")

</div>

> [@Kirk](#):
>
> I submitted an idea a few years back. As every object in FM has a unique, never to be reused ID, each object should have an associated default object name.

Those name would the be something like TextBox1, TestBox2. etc. This is the kind of object names I don't use, I prefer using meaningful names like FisrtName and LastName. When looking at a script you know which data you are manipulating.

---

<div class="post-metadata">

**Author:** ![Kirk](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/kirk/32/2197_2.png) [@Kirk](https://the.fmsoup.org/u/Kirk)\
**Post date:** [June 12, 2022, 3:43am UTC](https://the.fmsoup.org/t/passing-a-button-or-button-bar-object-name/2944/7 "2022-06-12T03:43:29Z")

</div>

They already "name" them things like "Panel", but are not persistent named objects. "Panel\_143" would be useful - the numeric object ID is already there under the covers - and I could always rename it if needed to have a more memorable name.
