diff options
| author | Michael <[email protected]> | 2017-07-03 22:03:58 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-07-03 22:03:58 -0400 |
| commit | d23c5cc29dc47537d1cf6069f27009750fd80919 (patch) | |
| tree | 971c8db7c7ef08c5efa1d867b98bfc01b2096f97 /ShiftOS.Frontend/GUI | |
| parent | 23e622ffc37fa7b2f5c21378b60912af46289575 (diff) | |
| download | shiftos_thereturn-d23c5cc29dc47537d1cf6069f27009750fd80919.tar.gz shiftos_thereturn-d23c5cc29dc47537d1cf6069f27009750fd80919.tar.bz2 shiftos_thereturn-d23c5cc29dc47537d1cf6069f27009750fd80919.zip | |
HELP ME. I can't get autoscroll working in terminall.
Diffstat (limited to 'ShiftOS.Frontend/GUI')
| -rw-r--r-- | ShiftOS.Frontend/GUI/TextControl.cs | 1 | ||||
| -rw-r--r-- | ShiftOS.Frontend/GUI/TextInput.cs | 42 |
2 files changed, 42 insertions, 1 deletions
diff --git a/ShiftOS.Frontend/GUI/TextControl.cs b/ShiftOS.Frontend/GUI/TextControl.cs index 9bf240f..9bc70e8 100644 --- a/ShiftOS.Frontend/GUI/TextControl.cs +++ b/ShiftOS.Frontend/GUI/TextControl.cs @@ -92,7 +92,6 @@ namespace ShiftOS.Frontend.GUI } - base.OnPaint(gfx); gfx.DrawString(_text, _font, new SolidBrush(Engine.SkinEngine.LoadedSkin.ControlTextColor), new RectangleF(loc.X, loc.Y, sMeasure.Width, sMeasure.Height)); } } diff --git a/ShiftOS.Frontend/GUI/TextInput.cs b/ShiftOS.Frontend/GUI/TextInput.cs index e59e927..c4e5260 100644 --- a/ShiftOS.Frontend/GUI/TextInput.cs +++ b/ShiftOS.Frontend/GUI/TextInput.cs @@ -17,6 +17,48 @@ namespace ShiftOS.Frontend.GUI private int _index = 0; private Font _font = new Font("Tahoma", 9f); + public int Index + { + get + { + return _index; + } + set + { + if (_index == value) + return; + if(_text.Length == 0) + { + _index = 0; + return; + } + _index = MathHelper.Clamp(value, 0, _text.Length - 1); + if (_text[_index] == '\n') + _index++; + Invalidate(); + } + } + + public string Text + { + get + { + return _text; + } + set + { + if (_text == value) + return; + + _text = value; + if(_index >= _text.Length) + { + _index = _text.Length - 1; + } + Invalidate(); + } + } + protected override void OnKeyEvent(KeyEvent e) { if(e.Key == Microsoft.Xna.Framework.Input.Keys.Left) |
