Allow changing choose-elem-button's mouse button

Things that we aren't going to implement
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Allow changing choose-elem-button's mouse button

Post 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.
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.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13173
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Allow changing choose-elem-button's mouse button

Post 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.
If you want to get ahold of me I'm almost always on Discord.

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

Re: Allow changing choose-elem-button's mouse button

Post 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?
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.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13173
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Allow changing choose-elem-button's mouse button

Post 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.
If you want to get ahold of me I'm almost always on Discord.

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

Re: Allow changing choose-elem-button's mouse button

Post 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.
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.

Post Reply

Return to “Won't implement”