From 6c3e9116ff837b7e074d978eb0e2566d72990212 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 8 Nov 2020 18:16:12 +0100 Subject: [PATCH] return the element added by Dropdown --- MLEM.Ui/Elements/Dropdown.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MLEM.Ui/Elements/Dropdown.cs b/MLEM.Ui/Elements/Dropdown.cs index 54ef10e..9625577 100644 --- a/MLEM.Ui/Elements/Dropdown.cs +++ b/MLEM.Ui/Elements/Dropdown.cs @@ -69,8 +69,8 @@ namespace MLEM.Ui.Elements { /// /// The text to display /// The resulting paragraph's event - public void AddElement(string text, GenericCallback pressed = null) { - this.AddElement(p => text, pressed); + public Element AddElement(string text, GenericCallback pressed = null) { + return this.AddElement(p => text, pressed); } /// @@ -79,7 +79,7 @@ namespace MLEM.Ui.Elements { /// /// The text to display /// The resulting paragraph's event - public void AddElement(Paragraph.TextCallback text, GenericCallback pressed = null) { + public Element AddElement(Paragraph.TextCallback text, GenericCallback pressed = null) { var paragraph = new Paragraph(Anchor.AutoLeft, 1, text) { CanBeMoused = true, CanBeSelected = true, @@ -90,6 +90,7 @@ namespace MLEM.Ui.Elements { paragraph.OnMouseEnter += e => paragraph.TextColor = Color.LightGray; paragraph.OnMouseExit += e => paragraph.TextColor = Color.White; this.AddElement(paragraph); + return paragraph; } }