# GP4 Custom Slider Question; I want to annotate at slider position

**URL:** https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330
**Category:** Libraries
**Created:** [April 30, 2020, 11:10pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330 "2020-04-30T23:10:46Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![wakewatcher](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@wakewatcher](https://discourse.processing.org/u/wakewatcher)
#### Post date: [April 30, 2020, 11:10pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/1 "2020-04-30T23:10:46Z")

</div>

I’d like to add some text above or below where the slider marker currently is sitting. I guess I could brute force it somehow using map(), getValueS and some trial and error offsets but since the slider already knows where it’s at in the frame, to show values via setShowValue(), I was hoping I could somehow get those coordinates so I could put my own text there instead.(Sorry about the run on sentence. Sadly that’s how I code too. Sigh… 🙂

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [May 1, 2020, 9:01am UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/2 "2020-05-01T09:01:34Z")

</div>

You can already do this with

```auto
slider1.setShowValue(true); // thumb value
slider1.setShowLimits(true); // min/ max values

```

---

<div class="post-metadata">

### Author: ![wakewatcher](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@wakewatcher](https://discourse.processing.org/u/wakewatcher)
#### Post date: [May 1, 2020, 3:44pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/3 "2020-05-01T15:44:25Z")

</div>

Thanks. From the docs it wasn’t clear to me how to set the value or how to offset it. What I’m wanting to do is as the handle is set I want to show the date, eg. 5/1/2020 in an area below the slider. So was hoping somehow to get the x value in the frame where the handle is currently positioned. Probably simple but I couldn’t figure it out.

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [May 1, 2020, 3:51pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/4 "2020-05-01T15:51:02Z")

</div>

Sorry that option is not available in G4P

---

<div class="post-metadata">

### Author: ![wakewatcher](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@wakewatcher](https://discourse.processing.org/u/wakewatcher)
#### Post date: [May 1, 2020, 4:01pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/5 "2020-05-01T16:01:59Z")

</div>

Well that makes me feel (somewhat) better. Just thought I was missing something. Maybe I can brute force something using getvalue() and use that with an offset constant to reasonably approximate the actual x value in the frame. Thanks for a your great contributions!

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [May 1, 2020, 4:11pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/6 "2020-05-01T16:11:29Z")

</div>

Its easy, assume the slider is called `s` then the horizontal position of the thumb centre is given by

`float x = map(s.getValueF(), s.getStartValue(), s.getEndValue(), s.getX(), s.getX() + s.getWidth());`

---

<div class="post-metadata">

### Author: ![wakewatcher](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@wakewatcher](https://discourse.processing.org/u/wakewatcher)
#### Post date: [May 1, 2020, 4:54pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/7 "2020-05-01T16:54:21Z")

</div>

map()! Of course! Thanks!

---

<div class="post-metadata">

### Author: ![wakewatcher](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@wakewatcher](https://discourse.processing.org/u/wakewatcher)
#### Post date: [May 1, 2020, 5:33pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/8 "2020-05-01T17:33:23Z")

</div>

Hmmm… It didn’t resolve the getStartValue() and getEndValue() methods. Tried getStartValueI() and getEndValueI() and also no joy. Also I didn’t find them in the reference. Sorry I’m pretty dense about these things.

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [May 1, 2020, 5:43pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/9 "2020-05-01T17:43:06Z")

</div>

Sorry that’s `getStartLimit` and `getEndLimit`, my mistake LOL

---

<div class="post-metadata">

### Author: ![wakewatcher](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@wakewatcher](https://discourse.processing.org/u/wakewatcher)
#### Post date: [May 1, 2020, 6:08pm UTC](https://discourse.processing.org/t/gp4-custom-slider-question-i-want-to-annotate-at-slider-position/20330/10 "2020-05-01T18:08:40Z")

</div>

That did it thanks. Perfect!
