mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
Preparation for custom popups
This commit is contained in:
parent
12434590f4
commit
269365fd75
25 changed files with 124 additions and 135 deletions
|
@ -930,55 +930,6 @@ static int luaGetGeneralSettings(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function popupInput(title, event, input, min, max)
|
||||
|
||||
Raises a pop-up on screen that allows uses input
|
||||
|
||||
@param title (string) text to display
|
||||
|
||||
@param event (number) the event variable that is passed in from the
|
||||
Run function (key pressed)
|
||||
|
||||
@param input (number) value that can be adjusted by the +/- keys
|
||||
|
||||
@param min (number) min value that input can reach (by pressing the - key)
|
||||
|
||||
@param max (number) max value that input can reach
|
||||
|
||||
@retval number result of the input adjustment
|
||||
|
||||
@retval "OK" user pushed ENT key
|
||||
|
||||
@retval "CANCEL" user pushed EXIT key
|
||||
|
||||
@notice Use only from stand-alone and telemetry scripts.
|
||||
|
||||
@status current Introduced in 2.0.0
|
||||
*/
|
||||
static int luaPopupInput(lua_State * L)
|
||||
{
|
||||
event_t event = luaL_checkinteger(L, 2);
|
||||
warningInputValue = luaL_checkinteger(L, 3);
|
||||
warningInputValueMin = luaL_checkinteger(L, 4);
|
||||
warningInputValueMax = luaL_checkinteger(L, 5);
|
||||
warningText = luaL_checkstring(L, 1);
|
||||
warningType = WARNING_TYPE_INPUT;
|
||||
runPopupWarning(event);
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
lua_pushstring(L, "OK");
|
||||
}
|
||||
else if (!warningText) {
|
||||
lua_pushstring(L, "CANCEL");
|
||||
}
|
||||
else {
|
||||
lua_pushinteger(L, warningInputValue);
|
||||
}
|
||||
warningText = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function popupWarning(title, event)
|
||||
|
||||
|
@ -1338,7 +1289,7 @@ const luaL_Reg opentxLib[] = {
|
|||
{ "playDuration", luaPlayDuration },
|
||||
{ "playTone", luaPlayTone },
|
||||
{ "playHaptic", luaPlayHaptic },
|
||||
{ "popupInput", luaPopupInput },
|
||||
// { "popupInput", luaPopupInput },
|
||||
{ "popupWarning", luaPopupWarning },
|
||||
{ "popupConfirmation", luaPopupConfirmation },
|
||||
{ "defaultStick", luaDefaultStick },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue