Update UI
Posted: Sat Apr 27, 2024 2:56 pm
is it possible to add item to the toolbar, outside DoLayout event? on UpdateWidget?
Code: Select all
-- **************************************************
-- General information about this script
-- **************************************************
ScriptName = "Test_Script"
Test_Script = {}
function Test_Script:Name()
return 'Test Script'
end
function Test_Script:Version()
return '1.0'
end
function Test_Script:UILabel()
return 'Test Script'
end
function Test_Script:Creator()
return 'Test'
end
function Test_Script:Description()
return 'Test'
end
-- **************************************************
-- Is Relevant / Is Enabled
-- **************************************************
function Test_Script:IsRelevant(moho)
print('IsRelevant')
return true
end
function Test_Script:IsEnabled(moho)
print('IsEnabled')
return true
end
-- **************************************************
-- Events
-- **************************************************
function Test_Script:OnMouseDown(moho, mouseEvent)
print('OnMouseDown')
end
function Test_Script:UpdateWidgets(moho)
print('UpdateWidgets')
end
function Test_Script:HandleMessage(msg)
print('HandleMessage')
end
function Test_Script:DoLayout(moho, layout)
print('DoLayout')
local simple_dialog = LM.GUI.SimpleDialog('', {})
local popup_dialog = LM.GUI.PopupDialog('Test', true, 0)
popup_dialog:SetDialog(simple_dialog)
layout:AddChild(popup_dialog, LM.GUI.ALIGN_LEFT, 0)
end
Code: Select all
if (msg == self.UPDATE or msg == self.ALT_UPDATE or msg == self.DELETE) then
local frame = moho.frame
if (frame == 0) then
moho:SetCurFrame(1)
else
moho:SetCurFrame(0)
end
moho:SetCurFrame(frame)
end
Code: Select all
local current_frame = moho.frame
moho:SetCurFrame(0)
local temp_layer = moho:CreateNewLayer(MOHO.LT_SWITCH, false)
moho:SetCurFrame(1)
moho:SetCurFrame(0)
moho:DeleteLayer(temp_layer)
moho:SetCurFrame(current_frame)