Anyone have an example of a working ui with input field?
Example of working UI with input field?Solved
what is wrong with it? works fine except for "Text" field
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);
}
}
}
Because your anchormax.y equal to anchormin.y on this component.
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.
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.
Not sure about color?
Color = "0 255 0 1" 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.
Merged post
Color = "1 1 1 1", no display
Merged post
Background image and the cancel button are there.
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.
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...
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...
There is no way to refresh element without re-creating it, sadly.
color is RGBA float, so ranged in 0-1 for each channel.
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....
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....
Locked automatically