custom per-gui element tooltip for minimap

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 153
Joined: Tue Feb 06, 2024 5:18 am
Contact:

custom per-gui element tooltip for minimap

Post by hgschmie »

Hi,

I have a gui with a number of elements (for train stations and trains). I want to be able to hover over a gui element (usually a piece of text like "xyz station" or "abc train") and that should show a minimap of either the train or station position.

There seems to be no rich text element for the minimap, so using the regular tooltip seems out of the question.

I looked into using the on_gui_hover and on_gui_leave events and I can open and close a frame relative to element.gui.screen or element.gui.center. But it seems impossible to open a frame right on the location where the text element that I am hovering over is located. I tried element.gui.relative but that does not show anything and calling my_popup_frame.bring_to_front() crashes with "Only elements in 'gui.screen' can use bring_to_front".

Any ideas? I just ran out of ideas (and claude code did as well)?
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 479
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: custom per-gui element tooltip for minimap

Post by Stringweasel »

+1
Alt-F4 Author | Factorio Modder
Probably known for: (Configurable) Valves | Better Victory Screen | Space Spidertron | Fluidic Power
Official Contributor to Space Exploration
User avatar
Osmo
Fast Inserter
Fast Inserter
Posts: 193
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: custom per-gui element tooltip for minimap

Post by Osmo »

This seems like it should be moved to (or opened as a new) modding interface requests since there is currently no way to do it
(and at least one person confused it with one, as almost did i :lol:)
User avatar
Osmo
Fast Inserter
Fast Inserter
Posts: 193
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: custom per-gui element tooltip for minimap

Post by Osmo »

Just being able to position elements at the cursor in some way would go a long way. I've worked on multiple mods where this would be useful.
For example anything that tries to replicate combinator GUIs will run into the issue of not being able to display "connected to" tooltips
изображение.png
изображение.png (24.98 KiB) Viewed 94 times
Replicating that tooltip is not that hard, and i quickly did it to demonstrate, however it is not possible to actually position it where its supposed to be
изображение.png
изображение.png (14.33 KiB) Viewed 94 times
So those tooltips are just not present in mods such as https://mods.factorio.com/mod/utility-combinators and https://mods.factorio.com/mod/disk

It'd also allow for cleaner guis in some cases, where stuff could be displayed just on hover instead of adding more buttons that activate certain elements or just leaving that functionality missing, such as with minimaps as outlined in the original post.

There are also other relevant topics asking for more ways to use tooltips, which are quite old viewtopic.php?t=77339 viewtopic.php?t=106528.
User avatar
protocol_1903
Filter Inserter
Filter Inserter
Posts: 386
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: custom per-gui element tooltip for minimap

Post by protocol_1903 »

+1
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
Post Reply

Return to “Modding interface requests”