Page 1 of 1
Allow changing choose-elem-button's mouse button
Posted: Thu Oct 19, 2017 8:35 am
by eradicator
TL;DR
Make it possible to activate choose-elem-button with something other than left-mouse-button.
What ?
Currently the selection menu (or clearing the selection) of choose-elem-button can only be invoked with left clicks. It would be nice if it was possible to change this on a per-button-basis to right/middle click with modifier keys. The button should then only invoke the selection menu with that exact button-combination and behave like a normal (sprite-)button for other clicks.
Optionally this could be implemented by allowing mods to invoke the selection menu from script (e.g. game.player.invoke_elem_selection_menu('id_string') ) and adding an event player_selected_element to recieve the choice. The invoke function should return "false" (or similar) if there is already an active selection menu opened. Optionally the invoke function could be passed a unique identifier string that is returned by the event to tell which "invoke_elem_selection_menu" call the "player_selected_element" event is related to.
Why ?
I'm trying to emulate base-gui style inventory slot interaction. In base filters can be set from a menu by middle-mouse-button clicking a slot. Currently the only method i can get this to work is to have the actual slot be a sprite-button that spawns a temporary choose-elem-button when middle-clicked.
Re: Allow changing choose-elem-button's mouse button
Posted: Thu Oct 19, 2017 6:47 pm
by Rseding91
The button works identically to the buttons in places like the requester chest, the constant combinator, and the deconstruction planner because it is literally the same button used between all of those and the choose elem button. There are no plans to change how it works.
Re: Allow changing choose-elem-button's mouse button
Posted: Thu Oct 19, 2017 10:24 pm
by eradicator
I see.
So how do the quickbar / car / cargo-wagon slot-buttons work with their middle-mouse-to-open-selection action?
And if that's not possible to make available to mod guis either, then how realistic would some sort of manual invocation be as described above?
Re: Allow changing choose-elem-button's mouse button
Posted: Fri Jan 26, 2018 6:59 am
by Rseding91
eradicator wrote:I see.
So how do the quickbar / car / cargo-wagon slot-buttons work with their middle-mouse-to-open-selection action?
And if that's not possible to make available to mod guis either, then how realistic would some sort of manual invocation be as described above?
Those are all inventory buttons. The choose-elem-button is not an inventory slot - it's a "chooser" button.
Re: Allow changing choose-elem-button's mouse button
Posted: Fri Jan 26, 2018 3:42 pm
by eradicator
Rseding91 wrote:Those are all inventory buttons. The choose-elem-button is not an inventory slot - it's a "chooser" button.
Well, then how do i make a button that behaves like an inventory button for the purpose of setting filters? So far the only possibility i see is to
reimplement the chosing menu in combination with a regular button. Unless you can somehow magically expose a new button type "inventory-button" to the gui api, but i have a feeling that it's not quite that easy.