# \[Feature Request\] Control touched global callback

**URL:** <https://forum.electra.one/t/feature-request-control-touched-global-callback/3368>\
**Category:** Developers\
**Created:** [November 11, 2024, 5:41pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368 "2024-11-11T17:41:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkrd](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@rkrd](https://forum.electra.one/u/rkrd)\
**Post date:** [November 11, 2024, 5:41pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/1 "2024-11-11T17:41:14Z")

</div>

It would be very useful to have a global callback which is fired whenever a control is touched via knob or screen. This callback would provide the control id as a parameter.

The use case that I have is creating a map between an external controller and the controls in the E1.

---

<div class="post-metadata">

**Author:** ![NewIgnis](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/newignis/32/767_2.png) [@NewIgnis](https://forum.electra.one/u/NewIgnis)\
**Post date:** [November 11, 2024, 8:55pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/2 "2024-11-11T20:55:37Z")

</div>

a global callback via the knob exists (they are called ‘pots’ in the documentation)

it’s called ‘onTouch’ or something. You need to subscribe to the service first in lua. It’s in the documentation.

Not sure there is a callback for ‘onScreen’. if you find it, let it know ok?

---

<div class="post-metadata">

**Author:** ![rkrd](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@rkrd](https://forum.electra.one/u/rkrd)\
**Post date:** [November 12, 2024, 7:59am UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/3 "2024-11-12T07:59:40Z")

</div>

I’m currently using the onPotTouched callback, but the interaction for my use case isn’t the best. Better would be onControlTouched, which is a reasonable contract “if this control is interacted with let me know”

---

<div class="post-metadata">

**Author:** ![NewIgnis](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/newignis/32/767_2.png) [@NewIgnis](https://forum.electra.one/u/NewIgnis)\
**Post date:** [November 12, 2024, 12:01pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/4 "2024-11-12T12:01:31Z")

</div>

Well, I’m also in favor of an onControlTouched, for instance to show help texts.

---

<div class="post-metadata">

**Author:** ![rkrd](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@rkrd](https://forum.electra.one/u/rkrd)\
**Post date:** [November 12, 2024, 12:42pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/5 "2024-11-12T12:42:16Z")

</div>

Indeed, that’s a nice use case. Out of curiosity, is there already a way to write some overlay text which might span multiple controls?

---

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [November 12, 2024, 1:02pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/6 "2024-11-12T13:02:51Z")

</div>

If you define a group label across the top of 2 or 3 controls, I think you can get 40 characters in there. For debugging, sometimes I’ll throw up 2 labels and have 80 characters for messages.

(I have a preset that does that - don’t know if it’s public).

---

<div class="post-metadata">

**Author:** ![Flyweight](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/flyweight/32/342_2.png) [@Flyweight](https://forum.electra.one/u/Flyweight)\
**Post date:** [November 12, 2024, 2:03pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/7 "2024-11-12T14:03:42Z")

</div>

> [@NewIgnis](#):
>
> onControlTouched

Yeah that seems usefull.

What is your use case?

I did something like this:

```auto
-- Use pot touched to save initial value and then use pot released touched=false 
-- As the last value. Then calculate how many arrows up or down and send them ??
function events.onPotTouch(potId, controlId, touched)
  --print ("controlId: " .. controlId)
  local myCtl = controls.get(controlId)
  local myVal = myCtl:getValue("value")
  local myMsg = myVal:getMessage()
  currentParameterNumber = myMsg:getParameterNumber() 

   lastTouchValue = myMsg:getValue()

end
```

---

<div class="post-metadata">

**Author:** ![rkrd](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@rkrd](https://forum.electra.one/u/rkrd)\
**Post date:** [November 12, 2024, 3:43pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/8 "2024-11-12T15:43:22Z")

</div>

I have a “Learn” control which when trigger will listen for incoming midi from external devices and then map these to E1 controls. The way I select which controls are being mapped is with events.onPotTouch but this is sub-optimal, due to having to first having to select the right section of the screen and then tapping the pot instead of just tapping the control directly on the touch screen.

---

<div class="post-metadata">

**Author:** ![Flyweight](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/flyweight/32/342_2.png) [@Flyweight](https://forum.electra.one/u/Flyweight)\
**Post date:** [November 12, 2024, 4:22pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/9 "2024-11-12T16:22:17Z")

</div>

Ah I see. I like the idea it is cool,

“midi learn” in a template would be cool and useful in Ableton.  
And of course in synths that have assignable controls.

Could you share the code or do you have it in a template available?

---

<div class="post-metadata">

**Author:** ![NewIgnis](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/newignis/32/767_2.png) [@NewIgnis](https://forum.electra.one/u/NewIgnis)\
**Post date:** [November 12, 2024, 6:13pm UTC](https://forum.electra.one/t/feature-request-control-touched-global-callback/3368/10 "2024-11-12T18:13:15Z")

</div>

I’m using pot touch in the Ub-Xa preset. When you touch a pot it shows briefly the key combination of the control, so you don’t have to memorize how on the physical synth the menu diving or shift / hold combinations take place.  
In other words it turns the E1 in an interactive manual for the synth
