LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   How can i get a Button working? (https://www.lotrointerface.com/forums/showthread.php?t=1680)

Haupthir 11-14-2011 11:40 AM

How can i get a Button working?
 
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.

Garan 11-14-2011 12:28 PM

Quote:

Originally Posted by Haupthir (Post 7373)
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);


Haupthir 11-14-2011 01:21 PM

Thanks, that helded me a lot

And how can turn the skirmWindow on and off with the Intro.SkirmWindow Butten.

I gess it works with and if, then funktion, but i cant get it working ...

May someone could help me again ...


All times are GMT -5. The time now is 06:54 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI