Key modifiers in on_gui_click

Place to get help with not working mods / modding interface.
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Key modifiers in on_gui_click

Post by apriori »

How to find out if gui button was clicked with Shift or Ctrl?
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Key modifiers in on_gui_click

Post by aubergine18 »

Doesn't seem to be any way to achieve this at present. You could possibly define the button events separately and then see if both events are fired within short space of time (the key first, then the button within 2 seconds or something)?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: Key modifiers in on_gui_click

Post by apriori »

Well, does "shift"-hotkey fires each tick while being pressed? If so, then it's possible to handle.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Key modifiers in on_gui_click

Post by aubergine18 »

No, I think the hotkeys only fire once when first detected - they don't fire again until the key is released and then pressed again.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: Key modifiers in on_gui_click

Post by apriori »

It's bad. I think devs should add event.key_modifier to the on_gui_click event...
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Key modifiers in on_gui_click

Post by aubergine18 »

Yes, it would be very welcome. Head over to the modding interface requests forum and put in a request?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Post Reply

Return to “Modding help”