[Twinsen][1.1.5] Modded notched_slider button has no tooltip.

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

[Twinsen][1.1.5] Modded notched_slider button has no tooltip.

Post by eradicator »

What

Contrary to vanilla gui slider buttons the tooltip for modded sliders only shows when the player hovers over the slider bar, but not when the player hovers the slider button.

Expected behavior

Setting a tooltip on the slider should automatically set it to the slider button.

I know that technically the slider and button are two different elements, but from the mod side i have no access to the button child LuaGuiElement as far as i understand. So i guess this is 50% bug report and 50% request ;)?

Reproduction

User the code. Drag the slider. See how the tooltip is only on the bar, not the button.

Code: Select all

/c
local p = game.player
p.gui.center.clear()

local f = p.gui.center.add{
  type = 'frame'
  }
  
local s = f.add{
  type = 'slider',
  minimum_value = 1,
  maximum_value = 10,
  value = 1,
  value_step = 1,
  discrete_slider = true,
  discrete_values = true,
  name = 'testslider',
  style = 'notched_slider',
  }
  
s.style.width = 200
  
script.on_event(defines.events.on_gui_value_changed, function(e)
  if e.element.name == 'testslider' then
    e.element.tooltip = e.element.slider_value .. '%'
    --[[ e.element.children[1].tooltip = e.element.slider_value .. '%' ]]
    end
  end)
Attachments
slidertooltip.png
slidertooltip.png (7.73 KiB) Viewed 2263 times
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Twinsen
Factorio Staff
Factorio Staff
Posts: 1341
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen][1.1.5] Modded notched_slider button has no tooltip.

Post by Twinsen »

We have some internal system that is not exposed to lua.

But for now I made it so that setting the tooltip on a slider will set the same tooltip on both the body and the notch.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Twinsen][1.1.5] Modded notched_slider button has no tooltip.

Post by eradicator »

Thank you berry much :).
Twinsen wrote:
Tue Dec 15, 2020 12:21 pm
But for now
Should i get my hopes up that in the future there might be more access? As i had a similar problem with the sliders internal elements i was a bit tempted to request access to each of the internal children styles. Assuming that if access was limited to the styles mods shouldn't be able to break the internal logic.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Twinsen
Factorio Staff
Factorio Staff
Posts: 1341
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen][1.1.5] Modded notched_slider button has no tooltip.

Post by Twinsen »

eradicator wrote:
Tue Dec 15, 2020 12:50 pm
Should i get my hopes up that in the future there might be more access? As i had a similar problem with the sliders internal elements i was a bit tempted to request access to each of the internal children styles. Assuming that if access was limited to the styles mods shouldn't be able to break the internal logic.
Eh, I wouldn't get my hopes up too much. There's nothing planned for now.

Post Reply

Return to “Resolved Problems and Bugs”