mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
move UIWindow to lua
This commit is contained in:
@@ -12,5 +12,6 @@ Module
|
||||
require 'uicombobox'
|
||||
require 'uiprogressbar'
|
||||
require 'uipopupmenu'
|
||||
require 'uiwindow'
|
||||
require 'tooltip/tooltip'
|
||||
require 'messagebox/messagebox'
|
@@ -10,8 +10,9 @@ function MessageBox.create(title, text, flags)
|
||||
setmetatable(box, MessageBox)
|
||||
|
||||
-- create messagebox window
|
||||
local window = displayUI('messagebox.otui', { locked = true })
|
||||
window:setTitle(title)
|
||||
local window = displayUI('messagebox.otui')
|
||||
window:lock()
|
||||
window:setText(title)
|
||||
|
||||
local label = window:getChildById('messageBoxLabel')
|
||||
label:setText(text)
|
||||
|
17
modules/core_widgets/uiwindow.lua
Normal file
17
modules/core_widgets/uiwindow.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
UIWindow = extends(UIWidget)
|
||||
|
||||
function UIWindow.create()
|
||||
local window = UIWindow.internalCreate()
|
||||
window:setTextAlign(AlignTopCenter)
|
||||
return window
|
||||
end
|
||||
|
||||
function UIWindow:onKeyPress(keyCode, keyText, keyboardModifiers)
|
||||
if keyboardModifiers == KeyboardNoModifier then
|
||||
if keyCode == KeyReturn or keyCode == KeyEnter then
|
||||
signalcall(self.onEnter, self)
|
||||
elseif keyCode == KeyEscape then
|
||||
signalcall(self.onEscape, self)
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user