messagebox (not working yet)

This commit is contained in:
Eduardo Bart
2011-04-23 17:04:49 -03:00
parent a98f1d67db
commit 3960240b8e
9 changed files with 61 additions and 94 deletions

View File

@@ -0,0 +1,12 @@
function messageBox(title, text)
local messageBoxWindow = loadUI("modules/messagebox/messagebox.yml")
local messageBoxLabel = messageBoxWindow:getChildByID("messageBoxLabel")
local messageBoxOkButton = messageBoxWindow:getChildByID("messageBoxOkButton")
local uiRoot = messageBoxWindow:getParent()
uiRoot:lock(messageBox)
messageBoxWindow:setTitle(text)
messageBoxLabel:setText(text)
messageBoxWindow:setSize(messageBoxLabel:getSize() + Size{20, 20})
messageBox:setOnDestroy(function() uiRoot:unlock() end)
messageBoxOkButton:setOnClick(function() messageBoxWindow:destroy() end)
end

View File

@@ -0,0 +1,18 @@
window#messageBoxWindow:
size: [236, 78]
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
label#messageBoxLabel:
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
margin.top: 27
button#messageBoxOkButton:
text: Ok
size: [43, 20]
anchors.right: parent.right
anchors.bottom: parent.bottom
margin.bottom: 10
margin.right: 10