Quote:
Originally Posted by Haupthir
I have created this butten:
Intro.SkirmWindow =Turbine.UI.Lotro.Button();
Intro.SkirmWindow:SetText(otherText[locale][6]);
Intro.SkirmWindow:SetPosition( 40, 40 );
Intro.SkirmWindow:SetSize( 150, 20 );
Intro.SkirmWindow:SetParent(Intro);
and i want that the button opens this window:
skirmWindow=Turbine.UI.Lotro.Window();
skirmWindow:SetSize(380,765);
skirmWindow:SetPosition(Turbine.UI.Display:GetWidt h()/2-190,Turbine.UI.Display:GetHeight()/2-300);
skirmWindow:SetText(otherText[locale][1]);
and it would be great if this window shuts down at the same time:
Intro=Turbine.UI.Lotro.Window();
Intro:SetSize(250,200);
Intro:SetPosition(Turbine.UI.Display:GetWidth()/2-190,Turbine.UI.Display:GetHeight()/2-300);
Intro:SetText(otherText[locale][5]);
Is this possible?
It would be great if somebody can help me.
|
To hide or show a window you use the :SetVisible() method.
To make a button perform an action, you assign a function to its MouseClick event.
For example, using the objects you originally posted:
Code:
skirmWindow=Turbine.UI.Lotro.Window();
skirmWindow:SetSize(380,765);
skirmWindow:SetPosition(Turbine.UI.Display:GetWidth()/2-190,Turbine.UI.Display:GetHeight()/2-300);
skirmWindow:SetText(otherText[locale][1]);
Intro=Turbine.UI.Lotro.Window();
Intro:SetSize(250,200);
Intro:SetPosition(Turbine.UI.Display:GetWidth()/2-190,Turbine.UI.Display:GetHeight()/2-300);
Intro:SetText(otherText[locale][5]);
Intro.SkirmWindow =Turbine.UI.Lotro.Button();
Intro.SkirmWindow:SetText(otherText[locale][6]);
Intro.SkirmWindow:SetPosition( 40, 40 );
Intro.SkirmWindow:SetSize( 150, 20 );
Intro.SkirmWindow:SetParent(Intro);
-- create the click event handler
Intro.SkirmWindow.MouseClick=function()
skirmWindow:SetVisible(true); -- show the skirmWindow
Intro:SetVisible(false); -- hide the Intro window
end
-- don't forget to make the Intro window visible initially (windows are not visible when created by default)
Intro:SetVisible(true);