Currently only 2 types of LuaGuiElement("button" or "sprite-button") can use the middle mouse button and buttons 4-9.
I quite often use in my fashion FNEI "choose-element-button" with the property "locked = true". When using "choose-element-button", the user can point to such button and in the tooltip see complete information about the recipe or the item. It is very convenient. However, the game's API does not support reading by pressing the middle mouse button. I do not really understand why you did not add this type of button? And in general, all elements have the right-click and left-click events, why you did not add "mouse_button_filter" for all LuaGuiElement?
[0.16.x] Choose-element-button middle mouse click event
Re: [0.16.x] Choose-element-button middle mouse click event
You can already do this. You just have to set the mouse button filter on the element to respond to what buttons you want: http://lua-api.factorio.com/latest/LuaG ... ton_filter
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [0.16.x] Choose-element-button middle mouse click event
No you can't. Choose-button errors when attempting to set a mouse filter:
I also noticed that normal buttons default to {'left','right'} and have to be explicitily changed to accept middle.
Code: Select all
/c a = game.player.gui.center.add{type='choose-elem-button',elem_type='item'} a.mouse_button_filter = {'left','right','middle'}
Code: Select all
"Error: Expected button or sprite-button."
Re: [0.16.x] Choose-element-button middle mouse click event
Ah right. Every widget does support mouse button filter but things like the choose elem button are hard coded to react to specific mouse buttons so clicking them with other buttons doesn't do anything.eradicator wrote:No you can't. Choose-button errors when attempting to set a mouse filter:Code: Select all
/c a = game.player.gui.center.add{type='choose-elem-button',elem_type='item'} a.mouse_button_filter = {'left','right','middle'}
I also noticed that normal buttons default to {'left','right'} and have to be explicitily changed to accept middle.Code: Select all
"Error: Expected button or sprite-button."
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [0.16.x] Choose-element-button middle mouse click event
Clicking it with left button is inconsistent with the base game gui though, where filters are set with middle mouse button. I wish we could just override the button. But...anyway, the real issue here is that abusing the choose-element-button is the only way to get a vanilla style item tooltip for a button. So how feasible is it to allow specifying vanilla tooptips for other gui elements? I.e. tooltip = 'item/iron-plate', or allowing us to make properly formated tooltips?Rseding91 wrote:Ah right. Every widget does support mouse button filter but things like the choose elem button are hard coded to react to specific mouse buttons so clicking them with other buttons doesn't do anything.
Re: [0.16.x] Choose-element-button middle mouse click event
No it isn't. A choose-elem-button is not an inventory-with-filters button. A choose-elem-button is the same as the deconstruction planner filters - they're literally the same underlying widget.eradicator wrote:Clicking it with left button is inconsistent with the base game gui though, where filters are set with middle mouse button. I wish we could just override the button. But...anyway, the real issue here is that abusing the choose-element-button is the only way to get a vanilla style item tooltip for a button. So how feasible is it to allow specifying vanilla tooptips for other gui elements? I.e. tooltip = 'item/iron-plate', or allowing us to make properly formated tooltips?Rseding91 wrote:Ah right. Every widget does support mouse button filter but things like the choose elem button are hard coded to react to specific mouse buttons so clicking them with other buttons doesn't do anything.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [0.16.x] Choose-element-button middle mouse click event
We modders don't have access to inventory-with-filters though (as far as i remember because of the linked ItemStack, so i don't even dare to ask to make that accessible...), besides it wouldn't fit this topics particular usecase. So we have to resuse other element types, sacrificing things here and there to get close to the behavior we need. And this is one of the cases where there's only bad compromises.Rseding91 wrote:No it isn't. A choose-elem-button is not an inventory-with-filters button. A choose-elem-button is the same as the deconstruction planner filters - they're literally the same underlying widget.eradicator wrote:Clicking it with left button is inconsistent with the base game gui though, where filters are set with middle mouse button. I wish we could just override the button. But...anyway, the real issue here is that abusing the choose-element-button is the only way to get a vanilla style item tooltip for a button. So how feasible is it to allow specifying vanilla tooptips for other gui elements? I.e. tooltip = 'item/iron-plate', or allowing us to make properly formated tooltips?Rseding91 wrote:Ah right. Every widget does support mouse button filter but things like the choose elem button are hard coded to react to specific mouse buttons so clicking them with other buttons doesn't do anything.
So, what about the other question about better tooltips?
Re: [0.16.x] Choose-element-button middle mouse click event
better tooltips would be the best solution to my problem)eradicator wrote:We modders don't have access to inventory-with-filters though (as far as i remember because of the linked ItemStack, so i don't even dare to ask to make that accessible...), besides it wouldn't fit this topics particular usecase. So we have to resuse other element types, sacrificing things here and there to get close to the behavior we need. And this is one of the cases where there's only bad compromises.Rseding91 wrote:No it isn't. A choose-elem-button is not an inventory-with-filters button. A choose-elem-button is the same as the deconstruction planner filters - they're literally the same underlying widget.eradicator wrote:Clicking it with left button is inconsistent with the base game gui though, where filters are set with middle mouse button. I wish we could just override the button. But...anyway, the real issue here is that abusing the choose-element-button is the only way to get a vanilla style item tooltip for a button. So how feasible is it to allow specifying vanilla tooptips for other gui elements? I.e. tooltip = 'item/iron-plate', or allowing us to make properly formated tooltips?Rseding91 wrote:Ah right. Every widget does support mouse button filter but things like the choose elem button are hard coded to react to specific mouse buttons so clicking them with other buttons doesn't do anything.
So, what about the other question about better tooltips?
Re: [0.16.x] Choose-element-button middle mouse click event
Another request for this feature.
In the mod FilterHelper, we do interactions of all 3 mouse buttons, using sprite-button.
I want to add support for Q on the buttons when using Cursor Enhancements (or 2.0's Q on anything feature), and found that the way to do it is with a locked choose-elem-button as above. However, this then stops us from using the middle button, as above.
In the mod FilterHelper, we do interactions of all 3 mouse buttons, using sprite-button.
I want to add support for Q on the buttons when using Cursor Enhancements (or 2.0's Q on anything feature), and found that the way to do it is with a locked choose-elem-button as above. However, this then stops us from using the middle button, as above.