moho:UpdateUI()
Posted: Sun May 05, 2024 10:08 pm
anyone knows why moho:UpdateUI() cause crash in dialog?
Code: Select all
-- **************************************************
-- General information about this script
-- **************************************************
ScriptName = "TestScript"
TestScript = {}
function TestScript:Name()
return 'Name'
end
function TestScript:Version()
return 'Version'
end
function TestScript:UILabel()
return 'UILabel'
end
function TestScript:Creator()
return 'Creator'
end
function TestScript:Description()
return 'Description'
end
-- **************************************************
-- Is Relevant / Is Enabled
-- **************************************************
function TestScript:IsRelevant(moho)
return true
end
function TestScript:IsEnabled(moho)
return true
end
-- **************************************************
-- Variables
-- **************************************************
local dialog_table = {}
-- **************************************************
-- Events
-- **************************************************
function TestScript:OnMouseDown(moho, mouseEvent)
end
function TestScript:DoLayout(moho, layout)
dialog_table.moho = moho
local dialog = LM.GUI.SimpleDialog('Dialog', dialog_table)
local dialog_layout = dialog:GetLayout()
local button = LM.GUI.Button('Update', MOHO.MSG_BASE)
dialog_layout:AddChild(button, LM.GUI.ALIGN_FILL, 0)
local popup = LM.GUI.PopupDialog('Popup', true, 0)
popup:SetDialog(dialog)
layout:AddChild(popup, LM.GUI.ALIGN_LEFT, 0)
end
function dialog_table:HandleMessage(msg)
--self.moho:UpdateUI() -- cause crash
end
Code: Select all
function dialog_table:HandleMessage(msg)
local helper = MOHO.ScriptInterfaceHelper:new_local()
local moho = helper:MohoObject()
moho:UpdateUI() -- cause crash
helper:delete()
end