add f2 to open, backspace to clear
This commit is contained in:
@@ -15,6 +15,8 @@ Imports DevExpress.XtraGrid.Columns
|
||||
Public Class LookupControl3
|
||||
Inherits GridLookUpEdit
|
||||
|
||||
Private Const TAG_BUTTON_LOOKUP_FORM = "openLookupForm"
|
||||
|
||||
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
|
||||
Public Shadows ReadOnly Property Properties As RepositoryItemLookupControl3
|
||||
Get
|
||||
@@ -36,6 +38,19 @@ Public Class LookupControl3
|
||||
e.Cancel = True
|
||||
End Sub
|
||||
|
||||
Private Sub LookupControl3_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp
|
||||
If e.KeyCode = Keys.F2 Then
|
||||
Dim oLookup As LookupControl3 = sender
|
||||
Dim oButton As EditorButton = oLookup.Properties.Buttons.
|
||||
Where(Function(b) b.Tag = TAG_BUTTON_LOOKUP_FORM).
|
||||
SingleOrDefault()
|
||||
|
||||
If oButton IsNot Nothing Then
|
||||
oLookup.PerformClick(oButton)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Shadows WithEvents fProperties As RepositoryItemGridLookUpEdit
|
||||
Friend WithEvents fPropertiesView As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
End Class
|
||||
|
||||
@@ -22,6 +22,8 @@ Public Class frmLookupGrid
|
||||
Private _Grid As GridControl
|
||||
Private ReadOnly _R As Resources.ResourceManager = My.Resources.Strings.ResourceManager
|
||||
|
||||
Private colCheckbox As GridColumn
|
||||
|
||||
#Region "Form Events"
|
||||
Private Sub frmLookupGrid_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
_View = viewLookup
|
||||
@@ -57,12 +59,12 @@ Public Class frmLookupGrid
|
||||
|
||||
If MultiSelect Then
|
||||
' Selected Spalte anpassen
|
||||
Dim oCheckboxColumn = _View.Columns.Item(0)
|
||||
colCheckbox = _View.Columns.Item(0)
|
||||
'oCheckboxColumn.Visible = False
|
||||
oCheckboxColumn.Caption = " "
|
||||
oCheckboxColumn.MaxWidth = 30
|
||||
oCheckboxColumn.MinWidth = 30
|
||||
oCheckboxColumn.OptionsColumn.AllowFocus = False
|
||||
colCheckbox.Caption = " "
|
||||
colCheckbox.MaxWidth = 30
|
||||
colCheckbox.MinWidth = 30
|
||||
colCheckbox.OptionsColumn.AllowFocus = False
|
||||
|
||||
|
||||
Text = _R.GetString("PopupForm_TextMultiselect")
|
||||
@@ -107,14 +109,24 @@ Public Class frmLookupGrid
|
||||
#End Region
|
||||
#Region "Button Events"
|
||||
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
|
||||
SaveSelectedValues()
|
||||
SaveAndClose()
|
||||
End Sub
|
||||
|
||||
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
|
||||
ClearAndClose()
|
||||
End Sub
|
||||
|
||||
Private Sub ClearAndClose()
|
||||
SelectedValues = New List(Of String)
|
||||
|
||||
DialogResult = DialogResult.OK
|
||||
Close()
|
||||
End Sub
|
||||
|
||||
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
|
||||
SelectedValues = New List(Of String)
|
||||
Private Sub SaveAndClose()
|
||||
' Make sure the currently focused row's state is saved
|
||||
viewLookup.PostEditor()
|
||||
SaveSelectedValues()
|
||||
|
||||
DialogResult = DialogResult.OK
|
||||
Close()
|
||||
@@ -130,17 +142,29 @@ Public Class frmLookupGrid
|
||||
End Sub
|
||||
|
||||
Private Sub HandleCustomKeys(e As KeyEventArgs)
|
||||
If e.KeyCode = Keys.Escape Then
|
||||
Select Case e.KeyCode
|
||||
Case Keys.Escape
|
||||
Close()
|
||||
|
||||
ElseIf e.KeyCode = Keys.F2 Then
|
||||
' Make sure the currently focused row's state is saved
|
||||
viewLookup.PostEditor()
|
||||
SaveSelectedValues()
|
||||
Case Keys.F2
|
||||
SaveAndClose()
|
||||
|
||||
DialogResult = DialogResult.OK
|
||||
Close()
|
||||
Case Keys.Back
|
||||
ClearAndClose()
|
||||
|
||||
Case Keys.Space
|
||||
If MultiSelect Then
|
||||
Dim oHandle = viewLookup.FocusedRowHandle
|
||||
If oHandle >= 0 Then
|
||||
Dim oIsChecked = viewLookup.GetRowCellValue(oHandle, colCheckbox)
|
||||
If oIsChecked Then
|
||||
viewLookup.SetRowCellValue(oHandle, colCheckbox, False)
|
||||
Else
|
||||
viewLookup.SetRowCellValue(oHandle, colCheckbox, True)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Select
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "View Events"
|
||||
|
||||
Reference in New Issue
Block a user