From 377b59deee91a6d9952533e15daecaa1f09a5124 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 19 Jan 2022 13:45:42 +0100 Subject: [PATCH] LookupControl: If AddNewValues is enabled, jump to new row after adding one --- Controls.LookupGrid/My Project/licenses.licx | 1 + Controls.LookupGrid/frmLookupGrid.Designer.vb | 15 +- Controls.LookupGrid/frmLookupGrid.resx | 174 +++++++----------- Controls.LookupGrid/frmLookupGrid.vb | 6 + 4 files changed, 74 insertions(+), 122 deletions(-) diff --git a/Controls.LookupGrid/My Project/licenses.licx b/Controls.LookupGrid/My Project/licenses.licx index e69de29b..887f6738 100644 --- a/Controls.LookupGrid/My Project/licenses.licx +++ b/Controls.LookupGrid/My Project/licenses.licx @@ -0,0 +1 @@ +DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/Controls.LookupGrid/frmLookupGrid.Designer.vb b/Controls.LookupGrid/frmLookupGrid.Designer.vb index 38cf40f2..848e2eb9 100644 --- a/Controls.LookupGrid/frmLookupGrid.Designer.vb +++ b/Controls.LookupGrid/frmLookupGrid.Designer.vb @@ -36,34 +36,21 @@ Partial Class frmLookupGrid 'gridLookup ' resources.ApplyResources(Me.gridLookup, "gridLookup") - Me.gridLookup.EmbeddedNavigator.AccessibleDescription = resources.GetString("gridLookup.EmbeddedNavigator.AccessibleDescription") - Me.gridLookup.EmbeddedNavigator.AccessibleName = resources.GetString("gridLookup.EmbeddedNavigator.AccessibleName") - Me.gridLookup.EmbeddedNavigator.AllowHtmlTextInToolTip = CType(resources.GetObject("gridLookup.EmbeddedNavigator.AllowHtmlTextInToolTip"), DevExpress.Utils.DefaultBoolean) - Me.gridLookup.EmbeddedNavigator.Anchor = CType(resources.GetObject("gridLookup.EmbeddedNavigator.Anchor"), System.Windows.Forms.AnchorStyles) - Me.gridLookup.EmbeddedNavigator.BackgroundImage = CType(resources.GetObject("gridLookup.EmbeddedNavigator.BackgroundImage"), System.Drawing.Image) - Me.gridLookup.EmbeddedNavigator.BackgroundImageLayout = CType(resources.GetObject("gridLookup.EmbeddedNavigator.BackgroundImageLayout"), System.Windows.Forms.ImageLayout) - Me.gridLookup.EmbeddedNavigator.ImeMode = CType(resources.GetObject("gridLookup.EmbeddedNavigator.ImeMode"), System.Windows.Forms.ImeMode) - Me.gridLookup.EmbeddedNavigator.MaximumSize = CType(resources.GetObject("gridLookup.EmbeddedNavigator.MaximumSize"), System.Drawing.Size) - Me.gridLookup.EmbeddedNavigator.TextLocation = CType(resources.GetObject("gridLookup.EmbeddedNavigator.TextLocation"), DevExpress.XtraEditors.NavigatorButtonsTextLocation) - Me.gridLookup.EmbeddedNavigator.ToolTip = resources.GetString("gridLookup.EmbeddedNavigator.ToolTip") - Me.gridLookup.EmbeddedNavigator.ToolTipIconType = CType(resources.GetObject("gridLookup.EmbeddedNavigator.ToolTipIconType"), DevExpress.Utils.ToolTipIconType) - Me.gridLookup.EmbeddedNavigator.ToolTipTitle = resources.GetString("gridLookup.EmbeddedNavigator.ToolTipTitle") Me.gridLookup.MainView = Me.viewLookup Me.gridLookup.Name = "gridLookup" Me.gridLookup.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.viewLookup}) ' 'viewLookup ' - resources.ApplyResources(Me.viewLookup, "viewLookup") Me.viewLookup.GridControl = Me.gridLookup Me.viewLookup.Name = "viewLookup" Me.viewLookup.OptionsView.ShowGroupPanel = False ' 'Panel1 ' - resources.ApplyResources(Me.Panel1, "Panel1") Me.Panel1.Controls.Add(Me.btnOK) Me.Panel1.Controls.Add(Me.btnClear) + resources.ApplyResources(Me.Panel1, "Panel1") Me.Panel1.Name = "Panel1" ' 'btnOK diff --git a/Controls.LookupGrid/frmLookupGrid.resx b/Controls.LookupGrid/frmLookupGrid.resx index 709e5ec6..a004d17c 100644 --- a/Controls.LookupGrid/frmLookupGrid.resx +++ b/Controls.LookupGrid/frmLookupGrid.resx @@ -117,24 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - OK (F2) - - - Panel1 + + + Fill 0, 0 - - 0 - - - DevExpress.XtraGrid.Views.Grid.GridView, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - - 0, 0 + + 388, 221 @@ -143,149 +135,115 @@ gridLookup - - 1 + + DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - + $this - - DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Panel1 - - - frmLookupGrid - - - - Bottom - - + 0 - - Leeren - - - 400, 300 - - - 1 - - - - None - - - - Center - - - 388, 261 - - - + + 12, 6 - - $this + + 117, 23 0 - - 117, 23 - - - DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + OK (F2) - - 240, 6 + + btnOK System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + Panel1 + + 0 - - Fill + + Top, Right + + + 240, 6 136, 23 - - viewLookup + + 0 - - Tile + + Leeren btnClear - - - - - Top, Left + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Wählen Sie einen oder mehrere Werte: + + Panel1 - - Inherit + + 1 - - Top, Right + + Bottom - - - Default + + 0, 221 388, 40 - - 388, 221 - - - 0, 221 + + 1 - + Panel1 - - btnOK - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - + + $this - - + + 1 + + True + 6, 13 - - 12, 6 + + 388, 261 + + + 390, 293 Wählen Sie einen Wert: - - 1 + + viewLookup + + + DevExpress.XtraGrid.Views.Grid.GridView, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + frmLookupGrid + + + DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - True - \ No newline at end of file diff --git a/Controls.LookupGrid/frmLookupGrid.vb b/Controls.LookupGrid/frmLookupGrid.vb index a5bbf50b..6f3eabe0 100644 --- a/Controls.LookupGrid/frmLookupGrid.vb +++ b/Controls.LookupGrid/frmLookupGrid.vb @@ -261,4 +261,10 @@ Public Class frmLookupGrid End If End If End Sub + + Private Sub viewLookup_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles viewLookup.FocusedRowChanged + If AddNewValues AndAlso e.PrevFocusedRowHandle = GridControl.NewItemRowHandle Then + BeginInvoke(Sub() viewLookup.FocusedRowHandle = GridControl.NewItemRowHandle) + End If + End Sub End Class \ No newline at end of file