mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
new lua function for creating widgets: createWidget
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
function dumpWidgets()
|
||||
for i=1,UI.root:getChildCount() do
|
||||
print(UI.root:getChildByIndex(i):getId())
|
||||
for i=1,rootWidget:getChildCount() do
|
||||
print(rootWidget:getChildByIndex(i):getId())
|
||||
end
|
||||
end
|
@@ -120,7 +120,7 @@ end
|
||||
|
||||
-- public functions
|
||||
function Console.init()
|
||||
consoleWidget = UI.display('console.otui', { visible = false })
|
||||
consoleWidget = displayUI('console.otui', { visible = false })
|
||||
connect(consoleWidget, { onKeyPress = onKeyPress })
|
||||
|
||||
commandLineEdit = consoleWidget:getChildById('commandLineEdit')
|
||||
@@ -139,10 +139,8 @@ end
|
||||
function Console.addLine(text, color)
|
||||
-- create new line label
|
||||
local numLines = consoleBuffer:getChildCount() + 1
|
||||
local label = UILabel.create()
|
||||
consoleBuffer:addChild(label)
|
||||
local label = createWidget('ConsoleLabel', consoleBuffer)
|
||||
label:setId('consoleLabel' .. numLines)
|
||||
label:setStyle('ConsoleLabel')
|
||||
label:setText(text)
|
||||
label:setForegroundColor(color)
|
||||
|
||||
|
Reference in New Issue
Block a user