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