SVN-Revision: r723
This commit is contained in:
cyf
2025-06-13 07:22:08 +00:00
parent 5c211d66d9
commit 3b1e09ea1e
9 changed files with 142 additions and 41 deletions
@@ -269,6 +269,11 @@ namespace Lskj.Control
this.EditValue = "";
this.Text = "";
}
if (string.IsNullOrWhiteSpace(this.EditValue)&& string.IsNullOrWhiteSpace(this.Text)&& this.Popup.TreeViewExObj.TreeView.SelectedNode != null)
{
// 树型下拉框要清空选中节点,否则下次再选相同的节点就选不上
this.Popup.TreeViewExObj.TreeView.SelectedNode = null;
}
}
}
/// <summary>
@@ -360,12 +365,18 @@ namespace Lskj.Control
this.LostFocus += new EventHandler(OnAutoGridLookUpLostFocus);
this.KeyUp += new KeyEventHandler(OnAutoGridLookUpKeyUp);
//禁用右键(右键中的粘贴,撤回等不会触发处理事件,如KeyUp等)
ContextMenuStrip emptyMenu = new ContextMenuStrip();
this.Properties.ContextMenuStrip = emptyMenu;
this._popup.TreeViewObj.LostFocus += new EventHandler(OnAutoGridLookUpPopupLostFocus);
if (isMultiClick) this._popup.TreeViewExObj.OnGridViewEnter += new KeyEventHandler(OnPopupGridViewEnter);
//if (!isMultiClick) this._popup.TreeViewExObj.OnTreeNodeMouseClick += new TreeNodeMouseClickEventHandler(OnPopupNodeMouseClick);
if (!isMultiClick) this._popup.TreeViewExObj.TreeNodeSelectAfter += new TreeViewEventHandler(OnPopupNodeSelectAfter);
}
@@ -470,7 +481,7 @@ namespace Lskj.Control
else
{
bool result = !string.IsNullOrEmpty(searchText);
if (result == isRefresh&& string.IsNullOrEmpty(searchText)) return;//连续2次都是空值,就不执行
if (result == isRefresh&& string.IsNullOrEmpty(searchText)) return;//连续2次搜索都是空值,就不执行
isRefresh = !string.IsNullOrEmpty(searchText);
// 数据库搜索
string sqlValue = string.Format("select * from ({0}\r\n) temp where {1} like '%{3}%' or {2} like '%{3}%' or dbo.P_getpy({2}) like '%{3}%'", string.IsNullOrEmpty(sourceParamSql) ? SourceSQL : sourceParamSql, ValueField, TextMember, searchText);
@@ -635,7 +646,6 @@ namespace Lskj.Control
}
//_popup.TreeViewObj.Focus();//给了焦点后就不能在文本框中做搜索或者删除操作了
}
}
/// <summary>
/// <para>说明:</para>
@@ -729,6 +739,9 @@ namespace Lskj.Control
{
this.HidePopup();
}
/*还是觉得该放到下面注释的位置 目前有一个节点名称为 abc 的,删除了bc后。 控件里只显示了a,但是选中节点依旧是abc,
* 下次如果不切换节点的话,在单击这个相同的节点。控件上的显示值不会刷新(显示a,但隐藏值是正确的)
*/
if (isRootNode) return;
//if (isRefresh) this.RefreshPopupDataSource("");
string text = string.Empty;
@@ -750,7 +763,9 @@ namespace Lskj.Control
{
this.EditText = this.Text;
}
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(keyValue, true);
//if (isRootNode) return;
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(this.EditValue + "", true);
if (nodes.Length > 0 && nodes[0].Nodes.Count > 0)
{
this.EditText = string.Empty;
@@ -794,7 +809,8 @@ namespace Lskj.Control
{
this.EditText = this.Text;
}
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(keyValue, true);
//if (isRootNode) return;
TreeNode[] nodes = _popup.TreeViewObj.Nodes.Find(this.EditValue + "", true);
if (nodes.Length > 0 && nodes[0].Nodes.Count > 0)
{
this.EditText = string.Empty;
@@ -809,4 +825,6 @@ namespace Lskj.Control
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The so
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="KeyEvnentArgs"/> instance containing the event data.</param>
prot