Fix dialog not closing on load failure

This commit is contained in:
Brahim Hadriche committed 2024-01-24 16:29:22 -05:00
1 parent b1a373f98d
commit d9b8aaa222
2 files changed
+12 -19

No files matched your search

@@ -109,5 +109,5 @@ function ShowPlayletLibLoadErrorDialog()
"If the problem persist, contact Playlet authors."
]
Dialog.ShowError(message, bulletText, bottomText)
DialogShowError(message, bulletText, bottomText)
end function
+11 -18
View File
@@ -1,9 +1,7 @@
namespace Dialog
function ShowError(message as object, bulletText as object, bottomMessage as object)
function DialogShowError(message as object, bulletText as object, bottomMessage as object)
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
msgDialog = CreateObject("roSGNode", "StandardMessageDialog")
SetPalette(msgDialog)
DialogSetPalette(msgDialog)
msgDialog.message = message
msgDialog.bulletText = bulletText
msgDialog.bottomMessage = bottomMessage
@@ -11,14 +9,14 @@ namespace Dialog
msgDialog.buttons = ["Exit"]
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
msgDialog.observeField("buttonSelected", "OnButtonSelected")
msgDialog.observeField("buttonSelected", "DialogOnButtonSelected")
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
msgDialog.observeField("wasClosed", "OnDialogClosed")
msgDialog.observeField("wasClosed", "DialogOnClosed")
m.top.getScene().dialog = msgDialog
end function
end function
function SetPalette(msgDialog as object)
function DialogSetPalette(msgDialog as object)
palette = createObject("roSGNode", "RSGPalette")
palette.colors = {
DialogBackgroundColor: "#242424FF"
@@ -29,17 +27,12 @@ namespace Dialog
DialogTextColor: "#DBDBDBFF"
}
msgDialog.palette = palette
end function
end function
function OnButtonSelected()
function DialogOnButtonSelected()
m.top.getScene().dialog.close = true
end function
end function
function OnDialogClosed()
' TODO:P1 throw an exception to cause a crash report to be generated
' Should include which playlet lib failed to load
function DialogOnClosed()
m.top.getScene().exitChannel = true
end function
end namespace
end function