KeyPress signature

KeyPress signature

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

KeyPress signature

Post by gajop »

Can anyone confirm what the correct signature for widget:KeyPress is?
According to the wiki it's

Code: Select all

addon.KeyPress(key, mods, isRepeat)
but it seems chili, and a bunch of other widgets including an old zk widget handler expect

Code: Select all

function widget:KeyPress(key, mods, isRepeat, label, unicode)
Now the second (chili-like) version works for me on Linux (96), but doesn't seem to be working on Windows (96.0 and 96.0.1-412-g7c7d24c). (All this can cause issues with text input if unicode is missing)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: KeyPress signature

Post by jK »

gajop wrote:Now the second (chili-like) version works for me on Linux (96), but doesn't seem to be working on Windows (96.0 and 96.0.1-412-g7c7d24c). (All this can cause issues with text input if unicode is missing)
TextInput has changed with 96+ (unicode arg is always 0) cause of SDL2 switch (not all text input is a keypress now).
check changelog
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: KeyPress signature

Post by gajop »

Well, this callin never gets invoked:

Code: Select all

function widget:TextInput(utf8, ...)
Maybe because my widgethandler is old? How do I update?
The widgets.lua from the spring repo doesn't seem to have a TextInput call-in either.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: KeyPress signature

Post by jK »

hmmm I always use new addonhandler in my dev environment, didn't thought of old widgethandler when I made the needed changes.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: KeyPress signature

Post by gajop »

What's the addonhandler, and how can I use it?
search comes up empty: https://github.com/spring/spring/search ... &type=Code
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: KeyPress signature

Post by abma »

Post Reply

Return to “Lua Scripts”