mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-30 15:41:30 +00:00
dd5689766d
Changed, Numeric textboxes: trailing zeros are no longer displayed to reduce visual noise. Fixed, paired numeric controls: in some cases culture-specific decimal separator was not used. Fixed, map loading: inability to initialize D3D device is now handled a bit more gracefully. Fixed, main toolbar context menu: we should suppress context menu closing only when user clicks on a menu item while holding Shift key. Fixed, Game configurations: several Skulltag things were not included in many Zandronum game configurations.
93 lines
1.8 KiB
C#
93 lines
1.8 KiB
C#
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
/*
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
* This program is released under GNU General Public License
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#endregion
|
|
|
|
#region ================== Namespaces
|
|
|
|
using System;
|
|
using System.Windows.Forms;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
{
|
|
public class AutoSelectTextbox : TextBox
|
|
{
|
|
#region ================== Constants
|
|
|
|
#endregion
|
|
|
|
#region ================== Variables
|
|
|
|
private int eventcount;
|
|
|
|
#endregion
|
|
|
|
#region ================== Properties
|
|
|
|
#endregion
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
#endregion
|
|
|
|
#region ================== Methods
|
|
|
|
// When gaining focus
|
|
protected override void OnGotFocus(EventArgs e)
|
|
{
|
|
base.OnGotFocus(e);
|
|
|
|
// Reset counter
|
|
eventcount = 0;
|
|
}
|
|
|
|
// When losing focus
|
|
protected override void OnLostFocus(EventArgs e)
|
|
{
|
|
base.OnLostFocus(e);
|
|
|
|
// Reset counter
|
|
eventcount = 0;
|
|
}
|
|
|
|
// When mouse pressed down
|
|
protected override void OnMouseDown(MouseEventArgs e)
|
|
{
|
|
base.OnMouseDown(e);
|
|
|
|
// Select all text when this mouseclick gives focus
|
|
if(eventcount == 0) this.SelectAll();
|
|
eventcount++;
|
|
}
|
|
|
|
// When key is pressed
|
|
protected override void OnKeyDown(KeyEventArgs e)
|
|
{
|
|
base.OnKeyDown(e);
|
|
eventcount++;
|
|
}
|
|
|
|
//mxd
|
|
new public bool Focus()
|
|
{
|
|
bool result = base.Focus();
|
|
this.Select(0, 0);
|
|
return result;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|