Some fixes for ASSA set layer

This commit is contained in:
niksedk 2023-08-17 08:45:35 +02:00
parent cfff37f67d
commit 20169ffd8c
4 changed files with 27 additions and 4 deletions

View File

@ -13,6 +13,9 @@ namespace Nikse.SubtitleEdit.Controls
// ReSharper disable once InconsistentNaming
public event EventHandler ValueChanged;
// ReSharper disable once InconsistentNaming
public new event KeyEventHandler KeyDown;
private decimal _value;
[Category("NikseUpDown"), Description("Gets or sets the default value in textBox"), RefreshProperties(RefreshProperties.Repaint)]
@ -230,6 +233,10 @@ namespace Nikse.SubtitleEdit.Controls
AddValue(Increment);
e.Handled = true;
}
else
{
KeyDown?.Invoke(sender, e);
}
};
_textBox.LostFocus += (sender, args) =>
{
@ -269,6 +276,17 @@ namespace Nikse.SubtitleEdit.Controls
TabStop = false;
}
protected override void OnGotFocus(EventArgs e)
{
if (_textBox != null)
{
_textBox.Focus();
return;
}
base.OnGotFocus(e);
}
private void _textBox_TextChanged(object sender, EventArgs e)
{
var text = _textBox.Text.Trim();

View File

@ -50,10 +50,10 @@ namespace Nikse.SubtitleEdit.Forms.Assa
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonRemoveAll = new System.Windows.Forms.Button();
this.buttonCopy = new System.Windows.Forms.Button();
this.textBoxTag = new System.Windows.Forms.TextBox();
this.textBoxTag = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.labelTag = new System.Windows.Forms.Label();
this.groupBoxTemplateItem = new System.Windows.Forms.GroupBox();
this.textBoxHint = new System.Windows.Forms.TextBox();
this.textBoxHint = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.labelHint = new System.Windows.Forms.Label();
this.contextMenuStripFile.SuspendLayout();
this.groupBoxTemplateItem.SuspendLayout();
@ -346,10 +346,10 @@ namespace Nikse.SubtitleEdit.Forms.Assa
private System.Windows.Forms.Button buttonAdd;
private System.Windows.Forms.Button buttonRemoveAll;
private System.Windows.Forms.Button buttonCopy;
private System.Windows.Forms.TextBox textBoxTag;
private Nikse.SubtitleEdit.Controls.NikseTextBox textBoxTag;
private System.Windows.Forms.Label labelTag;
private System.Windows.Forms.GroupBox groupBoxTemplateItem;
private System.Windows.Forms.TextBox textBoxHint;
private Nikse.SubtitleEdit.Controls.NikseTextBox textBoxHint;
private System.Windows.Forms.Label labelHint;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemRemoveAll;

View File

@ -1,6 +1,8 @@
using Nikse.SubtitleEdit.Logic;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Core.Common;
using System.Threading;
using System;
namespace Nikse.SubtitleEdit.Forms.Assa
{
@ -50,6 +52,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa
private void SetLayer_Shown(object sender, System.EventArgs e)
{
numericUpDownLayer.Focus();
SynchronizationContext.Current.Post(TimeSpan.FromMilliseconds(10), () => numericUpDownLayer.Focus());
}
}
}

View File

@ -9612,6 +9612,8 @@ namespace Nikse.SubtitleEdit.Forms
{
_subtitle.Paragraphs[index].Layer = form.Layer;
}
numericUpDownLayer.Value = form.Layer;
}
}
}