Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

widget.on_left_click triggers on keyboard press, but not on mouse clicks #8815

Open
ProditorMagnus opened this issue Apr 27, 2024 · 0 comments
Labels
Bug Issues involving unexpected behavior. Input Issues that involve the handling of user input and input devices. Lua API Issues with the Lua engine and API.

Comments

@ProditorMagnus
Copy link
Contributor

Game and System Information

  • Version: 1.19
  • OS: windows

Description of the bug

After running code, dialog appears. When pressing any regular key, (not esc, not enter), on_left_click triggers and chats. When using left click on widget, nothing happens.

Steps to reproduce the behavior

# lua wesnoth.require("wml-utils").handle_event_commands(wml.load("~add-ons/EventLoader/action.cfg"))
[lua]
	code=<<
local T = wml.tag
local chat = wesnoth.interface.add_chat_message
local sf = string.format

function wesnoth.wml_actions.stacked_widget_gui()
        local dialogDefinition = {
                wml.tag.tooltip { id = "tooltip_large" },
                wml.tag.helptip { id = "helptip_large" },
                wml.tag.grid {  wml.tag.row { wml.tag.column {
                        wml.tag.stacked_widget {
                                id = "stacker",
                                definition = "default",
                                T.layer {
                                        T.row { T.column { T.label { id="my_label1",label = "Hello world" } } }
                                },
                                T.layer {
                                        T.row { T.column { T.text_box { id="my_tb" } } }
                                }
                        }
                } } },
        }

        local function preshow(dialog)
			dialog.my_tb:focus()
			dialog.stacker.my_tb.on_left_click = function()
				chat("left click")
			end
        end
        gui.show_dialog(dialogDefinition,preshow)
end

wesnoth.wml_actions.stacked_widget_gui()
>>
[/lua]

Expected behavior

From documentation I would expect on_left_click trigger when left click is used, and not trigger when keyboard is used.

Additional context

https://forums.wesnoth.org/viewtopic.php?p=689120#p689120
https://wiki.wesnoth.org/LuaAPI/types/widget

@ProditorMagnus ProditorMagnus added the Bug Issues involving unexpected behavior. label Apr 27, 2024
@Wedge009 Wedge009 added Lua API Issues with the Lua engine and API. Input Issues that involve the handling of user input and input devices. labels Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues involving unexpected behavior. Input Issues that involve the handling of user input and input devices. Lua API Issues with the Lua engine and API.
Projects
None yet
Development

No branches or pull requests

2 participants