Files
playlet-piped/playlet-lib/src/components/Dialog/DialogUtils.bs
T
Brahim Hadriche e8fd7ee35d Fix/bugs (#161)
* Fix for execution timeout

* Multiple bug fixes
2023-10-04 18:16:57 -04:00

26 lines
1018 B
Plaintext

namespace DialogUtils
function ShowDialog(message as dynamic, title as string, large = false as boolean) as object
return ShowDialogButtons(message, title, ["Ok"], large)
end function
function ShowDialogButtons(message as dynamic, title as string, buttons as object, large = false as boolean) as object
dialog = CreateObject("roSGNode", "SimpleDialog")
if GetInterface(message, "ifArray") = invalid
message = message.Tokenize(`\n`).ToArray()
end if
dialog.message = message
dialog.title = title
dialog.buttons = buttons
if large
if m._deviceDisplayWidth = invalid
deviceInfo = CreateObject("roDeviceInfo")
displaySize = deviceInfo.GetDisplaySize()
m._deviceDisplayWidth = displaySize.w
end if
dialog.width = m._deviceDisplayWidth - 100
end if
m.top.getScene().dialog = dialog
return dialog
end function
end namespace