add depending controls for lookupgrid
This commit is contained in:
parent
acf61c9ca5
commit
b4e410291a
@ -8,6 +8,8 @@ Public Class ClassControls
|
||||
|
||||
Public Class ControlMeta
|
||||
Public Property IndexName As String
|
||||
Public Property IndexType As String
|
||||
Public Property MultipleValues As Boolean = False
|
||||
End Class
|
||||
|
||||
Public Sub New(Panel As Panel, Form As frmIndex)
|
||||
@ -23,7 +25,8 @@ Public Class ClassControls
|
||||
chk.Size = New Size(100, 27)
|
||||
chk.Location = New Point(11, y)
|
||||
chk.Tag = New ControlMeta() With {
|
||||
.IndexName = indexname
|
||||
.IndexName = indexname,
|
||||
.IndexType = "BOOLEAN"
|
||||
}
|
||||
|
||||
If caption <> "" Then
|
||||
@ -54,7 +57,7 @@ Public Class ClassControls
|
||||
PrepareDependingControl(sender)
|
||||
End Sub
|
||||
|
||||
Public Function AddVorschlag_ComboBox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Multiselect As Boolean, Optional Vorgabe As String = "", Optional AddNewValues As Boolean = False, Optional PreventDuplicateValues As Boolean = False) As Control
|
||||
Public Function AddVorschlag_ComboBox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Multiselect As Boolean, DataType As String, Optional Vorgabe As String = "", Optional AddNewValues As Boolean = False, Optional PreventDuplicateValues As Boolean = False) As Control
|
||||
Try
|
||||
Dim oSql As String = sql_Vorschlag
|
||||
Dim oConnectionString As String
|
||||
@ -66,11 +69,12 @@ Public Class ClassControls
|
||||
.Size = New Size(300, 27),
|
||||
.Name = "cmbMulti" & indexname,
|
||||
.Tag = New ControlMeta() With {
|
||||
.IndexName = indexname
|
||||
.IndexName = indexname,
|
||||
.IndexType = DataType
|
||||
}
|
||||
}
|
||||
|
||||
AddHandler oControl.
|
||||
AddHandler oControl.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged
|
||||
|
||||
oConnectionString = ClassFormFunctions.GetConnectionString(conid)
|
||||
If oConnectionString IsNot Nothing Then
|
||||
@ -90,6 +94,10 @@ Public Class ClassControls
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub Lookup_SelectedValuesChanged(sender As LookupControl2, SelectedValues As List(Of String))
|
||||
PrepareDependingControl(sender)
|
||||
End Sub
|
||||
|
||||
Function AddCombobox(indexname As String, y As Integer)
|
||||
Dim cmb As New ComboBox
|
||||
cmb.Name = "cmb" & indexname
|
||||
@ -251,31 +259,26 @@ Public Class ClassControls
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(" - Unvorhergesehener Unexpected error in Renew_ComboboxResults - Fehler: " & vbNewLine & ex.Message)
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in Renew_ComboboxResults:")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Function AddTextBox(indexname As String, y As Integer, text As String) As TextBox
|
||||
Public Function AddTextBox(indexname As String, y As Integer, text As String, DataType As String) As TextBox
|
||||
Dim txt As New TextBox
|
||||
txt.Name = "txt" & indexname
|
||||
|
||||
txt.Size = New Size(260, 27)
|
||||
txt.Location = New Point(11, y)
|
||||
txt.Tag = New ControlMeta() With {
|
||||
.IndexName = indexname
|
||||
.IndexName = indexname,
|
||||
.IndexType = DataType
|
||||
}
|
||||
|
||||
If text <> "" Then
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Controls.LookupGrid
|
||||
Imports WINDREAMLib
|
||||
|
||||
''' <summary>
|
||||
@ -151,8 +152,8 @@ Public Class ClassPatterns
|
||||
End If
|
||||
|
||||
Dim controlName As String = GetNextPattern(result, PATTERN_CTRL).Value
|
||||
'Dim control As Control = panel.Controls.Find(controlName, False).FirstOrDefault()
|
||||
Dim oFoundControl As Control = Nothing
|
||||
Dim oFoundType As String = Nothing
|
||||
|
||||
For Each oControl As Control In panel.Controls
|
||||
If TypeOf oControl Is Label Then
|
||||
@ -160,10 +161,10 @@ Public Class ClassPatterns
|
||||
End If
|
||||
|
||||
Dim oMeta = DirectCast(oControl.Tag, ClassControls.ControlMeta)
|
||||
Dim oIndex As String = oMeta.IndexName
|
||||
|
||||
If oIndex = controlName Then
|
||||
If oMeta.IndexName = controlName Then
|
||||
oFoundControl = oControl
|
||||
oFoundType = oMeta.IndexType
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
@ -175,6 +176,20 @@ Public Class ClassPatterns
|
||||
oValue = DirectCast(oFoundControl, TextBox).Text
|
||||
ElseIf TypeOf oFoundControl Is CheckBox Then
|
||||
oValue = IIf(DirectCast(oFoundControl, CheckBox).Checked, 1, 0)
|
||||
ElseIf TypeOf oFoundControl Is LookupControl2 Then
|
||||
Dim oLookupControl = DirectCast(oFoundControl, LookupControl2)
|
||||
|
||||
If oLookupControl.MultiSelect Then
|
||||
Select Case oFoundType
|
||||
Case "INTEGER"
|
||||
oValue = String.Join(",", oLookupControl.SelectedValues)
|
||||
Case "VARCHAR"
|
||||
Dim oWrapped = oLookupControl.SelectedValues.Select(Function(v) $"'{v}'")
|
||||
oValue = String.Join(",", oWrapped)
|
||||
End Select
|
||||
Else
|
||||
oValue = NotNull(oLookupControl.SelectedValues.Item(0), "")
|
||||
End If
|
||||
Else
|
||||
oValue = ""
|
||||
End If
|
||||
|
||||
5
Global_Indexer/frmAdministration.Designer.vb
generated
5
Global_Indexer/frmAdministration.Designer.vb
generated
@ -957,11 +957,6 @@ Partial Class frmAdministration
|
||||
'
|
||||
'XtraTabControl1
|
||||
'
|
||||
Me.XtraTabControl1.AppearancePage.HeaderHotTracked.BackColor = System.Drawing.Color.Fuchsia
|
||||
Me.XtraTabControl1.AppearancePage.HeaderHotTracked.BackColor2 = CType(resources.GetObject("XtraTabControl1.AppearancePage.HeaderHotTracked.BackColor2"), System.Drawing.Color)
|
||||
Me.XtraTabControl1.AppearancePage.HeaderHotTracked.Font = CType(resources.GetObject("XtraTabControl1.AppearancePage.HeaderHotTracked.Font"), System.Drawing.Font)
|
||||
Me.XtraTabControl1.AppearancePage.HeaderHotTracked.Options.UseBackColor = True
|
||||
Me.XtraTabControl1.AppearancePage.HeaderHotTracked.Options.UseFont = True
|
||||
resources.ApplyResources(Me.XtraTabControl1, "XtraTabControl1")
|
||||
Me.XtraTabControl1.Name = "XtraTabControl1"
|
||||
Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPage1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -424,9 +424,13 @@ Public Class frmAdministration
|
||||
If frmloaded = True Then
|
||||
If SUGGESTIONCheckBox.CheckState = CheckState.Checked Then
|
||||
btnSQLView.Visible = True
|
||||
'VKT_ADD_ITEMCheckbox.Enabled = True
|
||||
MULTISELECTCheckBox.Visible = True
|
||||
VKT_ADD_ITEMCheckbox.Visible = True
|
||||
|
||||
Else
|
||||
btnSQLView.Visible = False
|
||||
MULTISELECTCheckBox.Visible = False
|
||||
VKT_ADD_ITEMCheckbox.Visible = False
|
||||
|
||||
'If (_indexIsVectorField) Then
|
||||
' VKT_ADD_ITEMCheckbox.Enabled = True
|
||||
|
||||
@ -1502,32 +1502,32 @@ Public Class frmIndex
|
||||
End If
|
||||
Case "INTEGER"
|
||||
If DR.Item("SUGGESTION") = True And DR.Item("SQL_RESULT").ToString.Length > 0 Then
|
||||
Dim oControl = oControls.AddVorschlag_ComboBox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), MultiSelect, DefaultValue, AddNewItems, PreventDuplicates)
|
||||
Dim oControl = oControls.AddVorschlag_ComboBox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), MultiSelect, DR.Item("DATATYPE"), DefaultValue, AddNewItems, PreventDuplicates)
|
||||
If Not IsNothing(oControl) Then
|
||||
pnlIndex.Controls.Add(oControl)
|
||||
End If
|
||||
Else
|
||||
'nur eine Textbox
|
||||
Dim oControl = oControls.AddTextBox(DR.Item("NAME"), y, DefaultValue)
|
||||
Dim oControl = oControls.AddTextBox(DR.Item("NAME"), y, DefaultValue, DR.Item("DATATYPE"))
|
||||
If Not IsNothing(oControl) Then
|
||||
pnlIndex.Controls.Add(oControl)
|
||||
End If
|
||||
End If
|
||||
Case "VARCHAR"
|
||||
If DR.Item("SUGGESTION") = True And DR.Item("SQL_RESULT").ToString.Length > 0 Then
|
||||
Dim oControl = oControls.AddVorschlag_ComboBox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), MultiSelect, DefaultValue, AddNewItems, PreventDuplicates)
|
||||
Dim oControl = oControls.AddVorschlag_ComboBox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), MultiSelect, DR.Item("DATATYPE"), DefaultValue, AddNewItems, PreventDuplicates)
|
||||
If Not IsNothing(oControl) Then
|
||||
pnlIndex.Controls.Add(oControl)
|
||||
End If
|
||||
Else
|
||||
If DR.Item("NAME").ToString.ToLower = "dateiname" Then
|
||||
Dim oControl = oControls.AddTextBox(DR.Item("NAME"), y, System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE))
|
||||
Dim oControl = oControls.AddTextBox(DR.Item("NAME"), y, System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE), DR.Item("DATATYPE"))
|
||||
If Not IsNothing(oControl) Then
|
||||
pnlIndex.Controls.Add(oControl)
|
||||
End If
|
||||
Else
|
||||
Dim VORBELGUNG As String = DefaultValue
|
||||
Dim oControl = oControls.AddTextBox(DR.Item("NAME"), y, VORBELGUNG)
|
||||
Dim oControl = oControls.AddTextBox(DR.Item("NAME"), y, VORBELGUNG, DR.Item("DATATYPE"))
|
||||
If Not IsNothing(oControl) Then
|
||||
pnlIndex.Controls.Add(oControl)
|
||||
End If
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user