From 903f857ab0b10d9093aa89feb34827f4a0dd5f6f Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 10 Feb 2019 18:12:16 -0500 Subject: Corrected callback and added function for editbox Corrected the callback "onChanged" for edit boxes Also added a set_multiline(boolean) function, which sets if the textbox is multiline or not. --- src/client/lua_api/gui/iguieditbox.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/lua_api/gui/iguieditbox.cpp b/src/client/lua_api/gui/iguieditbox.cpp index 6e4efa9..7de3f37 100644 --- a/src/client/lua_api/gui/iguieditbox.cpp +++ b/src/client/lua_api/gui/iguieditbox.cpp @@ -65,7 +65,7 @@ static int newiguieditbox(lua_State* L){ lua_setmetatable(L,-2);//{editbox} setelementcallback(L,EGET_EDITBOX_ENTER,"onEnter"); - setelementcallback(L,EGET_EDITBOX_CHANGED,"onChanged"); + setelementcallback(L,EGET_EDITBOX_CHANGED,"onChange"); setelementcallback(L,EGET_EDITBOX_MARKING_CHANGED,"onMarkChange"); printf("Done creating editbox\n"); @@ -73,6 +73,16 @@ static int newiguieditbox(lua_State* L){ return 1; } +//self:setmultiline(bool_enabled) +int set_multiline(lua_State *L){ + int should = lua_toboolean(L,-1); + lua_pop(L,1); + lua_getfield(L,-1,"guielement"); + IGUIEditBox *e = (IGUIEditBox*)lua_touserdata(L,-1); + lua_pop(L,2); + e->setMultiLine(should == 1); + return 0; +} static const luaL_reg iguieditbox_f[] = { {"neweditbox",newiguieditbox}, @@ -80,6 +90,7 @@ static const luaL_reg iguieditbox_f[] = { }; static const luaL_reg iguieditbox_m[] = { + {"set_multiline",set_multiline}, {0,0}, }; -- cgit v1.2.3-70-g09d2