Account for changes in TextEditWidget, fix Password fields

This commit is contained in:
John Lewin 2018-10-22 15:40:54 -07:00
parent c5db51fff2
commit 1b239f2319
3 changed files with 22 additions and 3 deletions

View file

@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.VectorMath;
@ -37,17 +38,34 @@ namespace MatterHackers.MatterControl
{
private TextEditWidget passwordCoverText;
private class TextEditOverlay : TextEditWidget
{
public TextEditOverlay(string text, int pointSize, double pixelWidth, double pixelHeight, bool multiLine)
: base(text, 0, 0, pointSize, pixelWidth, pixelHeight, multiLine)
{
}
public override Color BackgroundColor
{
get => this.Parent.BackgroundColor;
set
{
this.Parent.BackgroundColor = value;
}
}
}
public MHPasswordTextEditWidget(string text, ThemeConfig theme, double pixelWidth = 0, double pixelHeight = 0, bool multiLine = false, int tabIndex = 0, string messageWhenEmptyAndNotSelected = "")
: base(text, theme, pixelWidth, pixelHeight, multiLine, tabIndex, messageWhenEmptyAndNotSelected)
{
// remove this so that we can have other content first (the hidden letters)
this.RemoveChild(noContentFieldDescription);
passwordCoverText = new TextEditWidget(text, 0, 0, theme.DefaultFontSize, pixelWidth, pixelHeight, multiLine)
passwordCoverText = new TextEditOverlay(text, theme.DefaultFontSize, pixelWidth, pixelHeight, multiLine)
{
Selectable = false,
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Bottom
VAnchor = VAnchor.Bottom,
};
passwordCoverText.MinimumSize = new Vector2(Math.Max(passwordCoverText.MinimumSize.X, pixelWidth), Math.Max(passwordCoverText.MinimumSize.Y, pixelHeight));
this.AddChild(passwordCoverText);

View file

@ -53,6 +53,7 @@ namespace MatterHackers.MatterControl
this.ActualTextEditWidget = new TextEditWidget(text, 0, 0, theme.DefaultFontSize, pixelWidth, pixelHeight, multiLine, tabIndex: tabIndex, typeFace: typeFace)
{
VAnchor = VAnchor.Bottom,
BackgroundColor = Color.Transparent
};
var internalWidget = this.ActualTextEditWidget.InternalTextEditWidget;

@ -1 +1 @@
Subproject commit 7c4f863bdf87d1a0fdfc82bfade3c969134fb237
Subproject commit 26b017d62a1fcd3f54d2d1336be4df7449ac9046