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

onfocus,offfocus events for lua #4345

Closed
robthomson opened this issue Aug 6, 2024 · 1 comment
Closed

onfocus,offfocus events for lua #4345

robthomson opened this issue Aug 6, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request lua
Milestone

Comments

@robthomson
Copy link
Collaborator

Please can we get some extra params for form field elements.

Current is as follows
local myField = form.addNumberField(line, nil, minValue, maxValue, function() return value end, function(newValue) value = newValue end)

Extend as follows

local myField = form.addNumberField(line, nil, minValue, maxValue, function() return value end, function(newValue) value = newValue end,function() return value end,function() return value end)

Essentially to do this:

line (FormLine): the line where the field should be added
rect (Rect): the coordinates
min (integer): the min value
max (integer): the max value
getValue (function): the function which will return the current value
setValue (function): the function which will be called on value change
onFocus (function): the function called when the field is selected (runs once)
offFocus(function): the function called when focus is removed from the field (runs once)

@bsongis-frsky bsongis-frsky added enhancement New feature or request lua labels Aug 14, 2024
@bsongis-frsky bsongis-frsky added this to the 1.5.14 milestone Aug 14, 2024
@bsongis-frsky bsongis-frsky self-assigned this Aug 20, 2024
@bsongis-frsky
Copy link
Collaborator

Here will be the new syntax for this:
field:onFocus(function(state) print("state=" .. state) end)
Will be available tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lua
Projects
None yet
Development

No branches or pull requests

2 participants