Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: [OptionPanelAPI] setTooltip issue?  (Read 816 times)

Matsor Browncoat

  • Ensign
  • *
  • Posts: 19
    • View Profile
[OptionPanelAPI] setTooltip issue?
« on: February 06, 2020, 09:37:36 AM »

I have the following code snippet, where opts is OptionPanelAPI in a PaginatedOptions.

Code
val testellino = listOf(1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 13.0) // Doesn't matter

opts.clearOptions()

opts.addOption("Save", "ShabroConfigurationsBack", "Save the Princess")
opts.setShortcut("ShabroConfigurationsBack", Keyboard.KEY_ESCAPE, false, false, false, true)

opts.addSelector("Testellone", "Testellone", Color.RED, 256f, 48f, 1f, testellino.size - 1f, ValueDisplayMode.NONE, "Quantity: 1")
opts.setSelectorValue("Testellone", 1f)

opts.setTooltip("Testellone", "Testellone of Quantity") // This doesn't do anything
opts.setTooltip("ShabroConfigurationsBack", "TESTELLONE MAGGICO") // This works as expected

In the snippet above, the first setTooltip (applied on a Selector) doesn't change its tooltip while the second setTooltip (applied on an Option) changes it correctly.

I'm wondering if maybe I'm doing something wrong?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: [OptionPanelAPI] setTooltip issue?
« Reply #1 on: February 06, 2020, 10:00:15 AM »

Ah - selectors don't support tooltips, apparently.
Logged

Matsor Browncoat

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: [OptionPanelAPI] setTooltip issue?
« Reply #2 on: February 06, 2020, 10:05:01 AM »

They do, the initial one in the addSelector call is applied correctly. It's just the setTooltip that isn't doing it.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: [OptionPanelAPI] setTooltip issue?
« Reply #3 on: February 06, 2020, 10:07:34 AM »

Alright, let me rephrase: the setTooltip() method doesn't support selectors :)
Logged

Matsor Browncoat

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: [OptionPanelAPI] setTooltip issue?
« Reply #4 on: February 06, 2020, 10:08:29 AM »

Sorry!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: [OptionPanelAPI] setTooltip issue?
« Reply #5 on: February 06, 2020, 10:17:01 AM »

It's all good, sorry if I came across a little snarky there.

I mean, the method probably *should* support selectors. It's just that I mostly moved away from using selectors at all for anything in vanilla, so they're not exactly at the top of my mind for how they work or for updating anything related. And changing this is actually non-trivial enough that I don't want to go messing with it.
Logged

Matsor Browncoat

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: [OptionPanelAPI] setTooltip issue?
« Reply #6 on: February 06, 2020, 10:22:14 AM »

If I might make a suggestion, that would solve the use case I had for updating a Selector's tooltip quite handily, is a way to override the displayed value of the Selector, even better if it's with a callback that takes the stored value as input. Right now we can only choose between ValueDisplayModes.

I don't know if that's at all possible or even in any way easier than solving the setTooltip issue, but I might as well throw it out there on the idea pile.
« Last Edit: February 06, 2020, 10:25:53 AM by Matsor Browncoat »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: [OptionPanelAPI] setTooltip issue?
« Reply #7 on: February 06, 2020, 10:27:24 AM »

Ah, yeah, that's actually a bit more complicated. If I start using selectors for anything in vanilla I'll try to have a look; right now they're definitely a bit sub-par, it's sort of a vestigial feature.
Logged