Clean up, fix missing TextEdit

This commit is contained in:
Jonathan Jenne
2023-06-02 10:47:24 +02:00
parent 8dade7c299
commit e44a42faea
8 changed files with 177 additions and 303 deletions

View File

@@ -25,6 +25,7 @@ Public Class frmMassValidator
Private CTRLS_Loaded As Boolean = False
Private FORM_Shown As Boolean = False
Private _dependingControl_in_action As Boolean = False
Private ControlCreator As ClassControlCreator
Private oErrorMessage As String
Private _windream As New ClassWindream_allgemein
@@ -43,6 +44,7 @@ Public Class frmMassValidator
'_windreamPM = New ClassPMWindream()
'_windreamPM.Create_Session()
ControlCreator = New ClassControlCreator(LOGCONFIG)
LOGGER.Debug("windream initialized frmMassValidator")
@@ -146,7 +148,7 @@ Public Class frmMassValidator
Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper
Case ClassControlCreator.PREFIX_TEXTBOX
LOGGER.Debug("Versuch TXT zu laden")
Dim txt As TextEdit = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
Dim txt As TextEdit = ControlCreator.CreateExistingTextbox(oControlRow, False)
AddHandler txt.GotFocus, AddressOf OnTextBoxFocus
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
@@ -155,19 +157,19 @@ Public Class frmMassValidator
oControl = txt
Case "LBL"
LOGGER.Debug("Versuch LBL zu laden")
oControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
oControl = ControlCreator.CreateExistingLabel(oControlRow, False)
Case "CMB"
LOGGER.Debug("Versuch CMB zu laden")
If oControlRow.Item("READ_ONLY") Then
Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
Dim cmbReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False)
oControl = cmbReadonly
Else
Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False)
Dim cmb = ControlCreator.CreateExistingCombobox(oControlRow, False)
AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex
#Region "CONTROL LIST"
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -179,7 +181,7 @@ Public Class frmMassValidator
LOGGER.Debug("ConID > 0 And commandsql <> ''")
Dim connectionString As String
Dim ConRow As DataRow() = ClassControlCreator.GET_CONNECTION_INFO(CURR_CON_ID)
Dim ConRow As DataRow() = ControlCreator.GET_CONNECTION_INFO(CURR_CON_ID)
If ConRow Is Nothing Then
MsgBox("Unexpected Error in getting Coninfo (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
@@ -277,26 +279,7 @@ Public Class frmMassValidator
End If
#End Region
'Dim oMaxWidth As Integer = cmb.Width
'Using oGraphics As Graphics = cmb.CreateGraphics()
' Dim oStringLength = oGraphics.MeasureString(Text, cmb.Font).Width
' If oStringLength + 30 > oMaxWidth Then
' oMaxWidth = oStringLength + 30
' End If
'End Using
'Using g As Graphics = Me.CreateGraphics
' For Each oItem As Object In cmb.Items 'Für alle Einträge...
' Dim g1 As Graphics = cmb.CreateGraphics
' If g1.MeasureString(Text, cmb.Font).Width + 30 > oMaxWidth Then
' oMaxWidth = g1.MeasureString(Text, cmb.Font).Width + 30
' End If
' g1.Dispose()
' Next oItem
'End Using
'cmb.DropDownWidth = oMaxWidth
@@ -311,10 +294,10 @@ Public Class frmMassValidator
Case "DTP"
LOGGER.Debug("Versuch DTP zu laden")
oControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
oControl = ControlCreator.CreateExistingDatepicker(oControlRow, False)
Case "DGV"
LOGGER.Debug("Versuch DGV zu laden")
Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False)
Dim dgv = ControlCreator.CreateExistingDataGridView(oControlRow, False)
AddHandler dgv.RowValidating, AddressOf onDGVRowValidating
@@ -322,20 +305,20 @@ Public Class frmMassValidator
Case "CHK"
LOGGER.Debug("Versuch Checkbox zu laden")
oControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
oControl = ControlCreator.CreateExisingCheckbox(oControlRow, False)
Case "LINE"
LOGGER.Debug("Versuch Linie zu laden")
oControl = ClassControlCreator.CreateExistingLine(oControlRow, False)
oControl = ControlCreator.CreateExistingLine(oControlRow, False)
Case "LOOKUP"
Dim oMultiselect = oControlRow.Item("MULTISELECT")
Dim oReadonly = oControlRow.Item("READ_ONLY")
If oMultiselect = False And oReadonly = True Then
Dim lookupReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
Dim lookupReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False)
oControl = lookupReadonly
Else
Dim lookup As LookupControl3 = ClassControlCreator.CreateExistingLookupControl(oControlRow, False)
Dim lookup As LookupControl3 = ControlCreator.CreateExistingLookupControl(oControlRow, False)
lookup.Properties.PreventDuplicates = oControlRow.Item("VKT_PREVENT_MULTIPLE_VALUES")
lookup.Properties.AllowAddNewValues = oControlRow.Item("VKT_ADD_ITEM")
@@ -373,7 +356,7 @@ Public Class frmMassValidator
LOGGER.Debug("Versuch Tabelle zu laden")
Dim oDTMyColumns As DataTable = DatabaseFallback.GetDatatableECM($"SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = {oControlRow.Item("GUID")} ORDER BY SEQUENCE") ', "MV_LoadControls1")
oControl = ClassControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False)
oControl = ControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False)
End Select
If oControl IsNot Nothing AndAlso TypeOf oControl IsNot Label Then
@@ -451,7 +434,6 @@ Public Class frmMassValidator
Sub FillIndexValues()
Dim controltype As String
Dim indexname As String
Dim resultvalue
Try
For Each oControl As Control In Me.pnldesigner.Controls
@@ -849,12 +831,12 @@ Public Class frmMassValidator
If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then
Try
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, box.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, box.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, box.Name) = False Then
If ControlCreator.GetDependingControls(DTCONTROLS, box.Name) = False Then
MsgBox("Unexpected Error in getting dependent controls - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -953,15 +935,15 @@ Public Class frmMassValidator
End Try
End Sub
Public Sub OnCmbselectedIndex(sender As System.Object, e As System.EventArgs)
Dim cmb As ComboBox = sender
Dim cmb As Windows.Forms.ComboBox = sender
If cmb.SelectedIndex <> -1 And CTRLS_Loaded = True And FORM_Shown = True Then
' Try
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties CMB - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, cmb.Name) = False Then
If ControlCreator.GetDependingControls(DTCONTROLS, cmb.Name) = False Then
MsgBox("Unexpected Error in getting dependent controls CMB- Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -999,12 +981,12 @@ Public Class frmMassValidator
Public Sub onDGVRowValidating(ByVal sender As Object, ByVal e As DataGridViewCellCancelEventArgs)
Dim dgv As DataGridView = sender
Try
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, dgv.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, dgv.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties DGV - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, dgv.Name) = False Then
If ControlCreator.GetDependingControls(DTCONTROLS, dgv.Name) = False Then
MsgBox("Unexpected Error in getting dependent controls DGV- Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -1228,7 +1210,7 @@ Public Class frmMassValidator
End Try
Case GetType(System.Windows.Forms.ComboBox)
Dim cmb As ComboBox = oControl
Dim cmb As Windows.Forms.ComboBox = oControl
Try
value_from_control = cmb.Text
Catch ex As Exception