Example of working UI with input field?Solved
Ts3hosting

Anyone have an example of a working ui with input field?
2CHEVSKII

what is wrong with it? works fine except for "Text" field
Ts3hosting
Original Poster

i Seem to not be able to get it to display..
var elements = new CuiElementContainer();
                    // msg = (useMessage) ? MessageNpc + "\n \n" + lang.GetMessage("money", this, player.UserIDString) + lang.GetMessage("money", this) : "";
                    if (msg == "")
                        //Sets the msg to unknown as we could not find a correct variable to match it with.
                        msg = lang.GetMessage("moneymsg", this, player.UserIDString) + lang.GetMessage("moneycolor", this, player.UserIDString) + yourmoney + lang.GetMessage("moneycolorend", this, player.UserIDString);
                    {
    var mainName = elements.Add(new CuiPanel
    {
        Image =
                {
                    Color = "0.1 0.1 0.1 1"
                },
        RectTransform =
                {
                    AnchorMin = "0.3 0.2",
                    AnchorMax = "0.7 0.9"
                },
        CursorEnabled = true
    }, "Overlay", "ATM");
    if (backroundimage == true)
    {
        elements.Add(new CuiElement
        {
            Parent = "ATM",
            Components =
                    {
                        new CuiRawImageComponent
                        {
                            Url = backroundimageurl,
                            Sprite = "assets/content/textures/generic/fulltransparent.tga"
                        },
                        new CuiRectTransformComponent
                        {
                    AnchorMin = "0 0",
                    AnchorMax = "1 1"
                        }
                    }
        });
    }

    var TestNameInput = new CuiElement
    {
        Name = "TestNameInput",
        Parent = "ATM",
        Components =
    {
        new CuiInputFieldComponent
        {
            Text = "123456",
            CharsLimit = 5,
           Color = "0 255 0 1",
            IsPassword = false,
            Command = "example.exampleinputtextcb",
            Font = "robotocondensed-regular.ttf",
            FontSize = 10,
            Align = TextAnchor.MiddleLeft
        },

        new CuiRectTransformComponent
        {
                     AnchorMin = "0.8 0.2",
                    AnchorMax = "0.9 0.2"
        }
    }
    };


    var Disagree = new CuiButton
    {


        Button =
                {

                    Close = mainName,
                    Color = "255 0 0 1"

                },
        RectTransform =
                {
                    AnchorMin = "0.5 0.2",
                    AnchorMax = "0.5 0.2",
                      OffsetMin = "-30 -20",
                      OffsetMax = "30 20"
                },
        Text =
                {
                    Text = "Cancel",
                    FontSize = 22,
                    Align = TextAnchor.MiddleCenter
                }
    };
    elements.Add(new CuiLabel
    {
        Text =
                {
                    Text = msg,
                    FontSize = 20,
                    Align = TextAnchor.MiddleCenter
                },
        RectTransform =
                {
                    AnchorMin = "0 0.75",
                    AnchorMax = "1 0.9"
                }
    }, mainName);

    elements.Add(TestNameInput);
    elements.Add(Disagree, mainName);
    CuiHelper.AddUi(player, elements);

}
}
}
​
2CHEVSKII

Because your anchormax.y equal to anchormin.y on this component.
Ts3hosting
Original Poster

i have tryed changing it to AnchorMin = "0.1 0.5",
AnchorMax = "0.2 0.5" still no go.

Merged post

AnchorMin = "0.1 0.6",
AnchorMax = "0.2 0.1"

Merged post

AnchorMin = "0 0",
AnchorMax = "1 1"     Nogo will not display the txtfield i must me missing somthing.
Ultra

Not sure about color?
Color = "0 255 0 1"​
Ts3hosting
Original Poster

i have changed that to 1 1 1 1

Merged post

Color = "1 1 1 1", no display

Merged post

Background image and the cancel button are there.
2CHEVSKII

I think you dont understand, how ui works at all. Look at existing plugins first. Things like AnchorMin = "0.1 0.5" AnchorMax = "0.2 0.5" *no display* make me cry.
Ts3hosting
Original Poster

i have looked around and i have buttons witch i can move around with the anchors i removed the button and replaced the input with the ancors from there and it still does not display...


also do you know if there is a way to make a element refresh the new value with out closing the ui window

Merged post

Ok i got the input working you were correct.. i need to edit the color code so i can see it any ideas? what to use

Merged post

What i seem to be missing is the color of the field... 
2CHEVSKII

There is no way to refresh element without re-creating it, sadly.

color is RGBA float, so ranged in 0-1 for each channel. 

Ts3hosting
Original Poster

Thanks i got it working just down to trying to figure out when i change somthing in the players datafile and save it the changes are not showing up untell i reload the plugin.

say i change there amount of money from 100 to 200 and save and go into the ui the ui still shows 100

Merged post

Ok got it all working except the datafile not refreshing when reponing the ui thanks for the help....

TravisButts