From 5ac8d0085b86fd5b40bf772187548820adc1f277 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 19 Aug 2016 21:17:45 +0200 Subject: [PATCH] src/gui/lua/lua_cc_text.cpp if dx and dy is not set and text have parent use Height and Width size from parent Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a648daba757c9d9b27a23269ecc3881ac5a2ec62 Author: Jacek Jendrzej Date: 2016-08-19 (Fri, 19 Aug 2016) --- src/gui/lua/lua_cc_text.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/lua/lua_cc_text.cpp b/src/gui/lua/lua_cc_text.cpp index f7ed3a540..243aeaf3a 100644 --- a/src/gui/lua/lua_cc_text.cpp +++ b/src/gui/lua/lua_cc_text.cpp @@ -77,7 +77,7 @@ int CLuaInstCCText::CCTextNew(lua_State *L) lua_assert(lua_istable(L,1)); CLuaCCWindow* parent = NULL; - lua_Integer x=10, y=10, dx=100, dy=100; + lua_Integer x=10, y=10, dx=-1, dy=-1; std::string text = ""; std::string tmpMode = ""; lua_Integer mode = CTextBox::AUTO_WIDTH; @@ -139,6 +139,16 @@ int CLuaInstCCText::CCTextNew(lua_State *L) } CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; + if(pw){ + if(dx == -1) + dx = pw->getHeight(); + if(dy == -1) + dy = pw->getWidth(); + } + if(dx == -1) + dx = 100; + if(dy == -1) + dy = 100; CLuaCCText **udata = (CLuaCCText **) lua_newuserdata(L, sizeof(CLuaCCText *)); *udata = new CLuaCCText();