mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-19 22:23:28 +02:00
Added waypoints for bot
This commit is contained in:
@@ -51,6 +51,64 @@ function show(widget)
|
||||
activeWindow:focus()
|
||||
end
|
||||
|
||||
function singlelineEditor(text, callback)
|
||||
if activeWindow then
|
||||
destroyWindow()
|
||||
end
|
||||
local window = g_ui.createWidget('TextEditWindow', rootWidget)
|
||||
|
||||
local destroy = function()
|
||||
window:destroy()
|
||||
if window == activeWindow then
|
||||
activeWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
window.okButton.onClick = function()
|
||||
local text = window.text:getText()
|
||||
destroy()
|
||||
callback(text)
|
||||
end
|
||||
window.cancelButton.onClick = destroy
|
||||
window.onEscape = destroy
|
||||
window.onEnter = window.okButton.onClick
|
||||
|
||||
window.text:setText(text)
|
||||
|
||||
activeWindow = window
|
||||
activeWindow:raise()
|
||||
activeWindow:focus()
|
||||
end
|
||||
|
||||
function multilineEditor(description, text, callback)
|
||||
if activeWindow then
|
||||
destroyWindow()
|
||||
end
|
||||
local window = g_ui.createWidget('TextEditMultilineWindow', rootWidget)
|
||||
|
||||
local destroy = function()
|
||||
window:destroy()
|
||||
if window == activeWindow then
|
||||
activeWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
window.okButton.onClick = function()
|
||||
local text = window.text:getText()
|
||||
destroy()
|
||||
callback(text)
|
||||
end
|
||||
window.cancelButton.onClick = destroy
|
||||
window.onEscape = destroy
|
||||
|
||||
window.description:setText(description)
|
||||
window.text:setText(text)
|
||||
|
||||
activeWindow = window
|
||||
activeWindow:raise()
|
||||
activeWindow:focus()
|
||||
end
|
||||
|
||||
function hide()
|
||||
destroyWindow()
|
||||
end
|
||||
|
@@ -23,3 +23,51 @@ TextEditWindow < MainWindow
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
width: 60
|
||||
|
||||
TextEditMultilineWindow < MainWindow
|
||||
id: texteditmultiline
|
||||
size: 650 497
|
||||
!text: tr("Edit text")
|
||||
|
||||
Label
|
||||
id: description
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text-auto-resize: true
|
||||
text-align: center
|
||||
text-wrap: true
|
||||
|
||||
MultilineTextEdit
|
||||
id: text
|
||||
anchors.top: textScroll.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: textScroll.left
|
||||
anchors.bottom: textScroll.bottom
|
||||
vertical-scrollbar: textScroll
|
||||
text-wrap: true
|
||||
|
||||
VerticalScrollBar
|
||||
id: textScroll
|
||||
anchors.top: description.bottom
|
||||
anchors.bottom: okButton.top
|
||||
anchors.right: parent.right
|
||||
margin-bottom: 10
|
||||
step: 16
|
||||
pixels-scroll: true
|
||||
|
||||
Button
|
||||
id: okButton
|
||||
!text: tr('Ok')
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: next.left
|
||||
margin-right: 10
|
||||
width: 60
|
||||
|
||||
Button
|
||||
id: cancelButton
|
||||
!text: tr('Cancel')
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
width: 60
|
||||
|
||||
|
Reference in New Issue
Block a user