LookupGrid: first version of LookupControl3
This commit is contained in:
@@ -57,7 +57,6 @@ Public Class RepositoryItemLookupControl3
|
||||
|
||||
Public Property AllowAddNewValues As Boolean
|
||||
Public Property PreventDuplicates As Boolean
|
||||
Public Overloads Property DataSource As DataTable
|
||||
|
||||
Public Delegate Sub SelectedValuesChangedHandler(sender As Object, SelectedValues As List(Of String))
|
||||
Public Event SelectedValuesChanged As SelectedValuesChangedHandler
|
||||
@@ -97,6 +96,12 @@ Public Class RepositoryItemLookupControl3
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Overrides Sub RaiseQueryPopUp(e As CancelEventArgs)
|
||||
If MultiSelect = True Then
|
||||
MyBase.RaiseQueryPopUp(e)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Shared Sub RegisterLookupControl()
|
||||
Dim img As Image = Nothing
|
||||
Dim oClassInfo = New EditorClassInfo(
|
||||
@@ -128,7 +133,7 @@ Public Class RepositoryItemLookupControl3
|
||||
FirstOrDefault()
|
||||
|
||||
If oButton IsNot Nothing Then
|
||||
oButton.Visible = pVisible
|
||||
oButton.Enabled = pVisible
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -149,8 +154,6 @@ Public Class RepositoryItemLookupControl3
|
||||
Values.RemoveAll(Function(v) String.IsNullOrEmpty(v))
|
||||
|
||||
If MultiSelect = True Then
|
||||
' DataSource = Values
|
||||
|
||||
Select Case Values.Count
|
||||
Case 0
|
||||
NullText = TEXT_NO_RECORDS
|
||||
@@ -161,7 +164,6 @@ Public Class RepositoryItemLookupControl3
|
||||
End Select
|
||||
Else
|
||||
NullText = Values.FirstOrDefault()
|
||||
OwnerEdit.Text = Values.FirstOrDefault()
|
||||
OwnerEdit.EditValue = Values.FirstOrDefault()
|
||||
End If
|
||||
|
||||
@@ -170,6 +172,21 @@ Public Class RepositoryItemLookupControl3
|
||||
RaiseEvent SelectedValuesChanged(Me, Values)
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub CreateDefaultButton()
|
||||
MyBase.CreateDefaultButton()
|
||||
|
||||
Dim oLookupFormButtonm = New EditorButton() With {
|
||||
.Kind = ButtonPredefines.Search,
|
||||
.Tag = TAG_BUTTON_LOOKUP_FORM,
|
||||
.Width = 20
|
||||
}
|
||||
|
||||
Buttons.Item(0).Tag = TAG_DROPDOWN
|
||||
Buttons.AddRange({oLookupFormButtonm})
|
||||
|
||||
ActionButtonIndex = 0
|
||||
End Sub
|
||||
|
||||
Private Function GetLookupForm() As frmLookupGrid
|
||||
Dim oForm As New frmLookupGrid() With {
|
||||
.MultiSelect = MultiSelect,
|
||||
@@ -185,19 +202,18 @@ Public Class RepositoryItemLookupControl3
|
||||
End Function
|
||||
|
||||
Protected Overrides Sub RaiseButtonClick(e As ButtonPressedEventArgs)
|
||||
Select Case e.Button.Tag
|
||||
Case TAG_BUTTON_LOOKUP_FORM
|
||||
Using oForm = GetLookupForm()
|
||||
Dim oResult = oForm.ShowDialog()
|
||||
MyBase.RaiseButtonClick(e)
|
||||
|
||||
If oResult = Windows.Forms.DialogResult.OK Then
|
||||
Dim oValues = oForm.SelectedValues
|
||||
UpdateSelectedValues(oValues)
|
||||
End If
|
||||
End Using
|
||||
Case Else
|
||||
MyBase.RaiseButtonClick(e)
|
||||
End Select
|
||||
If e.Button.Tag = TAG_BUTTON_LOOKUP_FORM Then
|
||||
Using oForm = GetLookupForm()
|
||||
Dim oResult = oForm.ShowDialog()
|
||||
|
||||
If oResult = Windows.Forms.DialogResult.OK Then
|
||||
Dim oValues = oForm.SelectedValues
|
||||
UpdateSelectedValues(oValues)
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Assign(item As RepositoryItem)
|
||||
@@ -212,23 +228,4 @@ Public Class RepositoryItemLookupControl3
|
||||
EndUpdate()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub CreateDefaultButton()
|
||||
MyBase.CreateDefaultButton()
|
||||
|
||||
Dim oLookupFormButtonm = New EditorButton() With {
|
||||
.Kind = ButtonPredefines.Search,
|
||||
.Tag = TAG_BUTTON_LOOKUP_FORM,
|
||||
.Width = 20
|
||||
}
|
||||
|
||||
Buttons.Item(0).Tag = TAG_DROPDOWN
|
||||
Buttons.AddRange({oLookupFormButtonm})
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub RaiseQueryPopUp(e As CancelEventArgs)
|
||||
If MultiSelect = True Then
|
||||
MyBase.RaiseQueryPopUp(e)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user