Switch from Textbox to DevExpress TextEdit

This commit is contained in:
Jonathan Jenne 2023-05-30 13:33:22 +02:00
parent 37b02ec625
commit 9da71349b2
6 changed files with 186 additions and 82 deletions

View File

@ -14,9 +14,11 @@ Imports DigitalData.Controls.LookupGrid
Imports DigitalData.Modules.Language.Utils Imports DigitalData.Modules.Language.Utils
Imports DigitalData.GUIs.Common Imports DigitalData.GUIs.Common
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language
Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback
Imports DigitalData.Modules.EDMI.API.Constants Imports DigitalData.Modules.EDMI.API.Constants
Imports DigitalData.Modules.Language.DataTableEx Imports DigitalData.Modules.Language.DataTableEx
Imports DigitalData.Modules.Base
Public Class ClassControlCreator Public Class ClassControlCreator
@ -86,6 +88,7 @@ Public Class ClassControlCreator
Public Guid As Integer Public Guid As Integer
Public Name As String Public Name As String
Public [ReadOnly] As Boolean = False Public [ReadOnly] As Boolean = False
Public BackColor As Color = Color.White
End Class End Class
Private Shared Function TransformDataRow(row As DataRow) As ControlDBProps Private Shared Function TransformDataRow(row As DataRow) As ControlDBProps
@ -146,8 +149,21 @@ Public Class ClassControlCreator
' ----------------------- NEW CONTROLS ----------------------- ' ----------------------- NEW CONTROLS -----------------------
Public Shared Function CreateNewTextBox(location As Point) As TextBox 'Public Shared Function CreateNewTextBox(location As Point) As TextBox
Dim control As New TextBox With { ' Dim control As New TextBox With {
' .Name = $"{PREFIX_TEXTBOX}_{clsTools.ShortGuid()}",
' .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT),
' .Location = location,
' .ReadOnly = True,
' .BackColor = Color.White,
' .Cursor = Cursors.Hand
' }
' Return control
'End Function
Public Shared Function CreateNewTextBox(location As Point) As TextEdit
Dim control As New TextEdit With {
.Name = $"{PREFIX_TEXTBOX}_{clsTools.ShortGuid()}", .Name = $"{PREFIX_TEXTBOX}_{clsTools.ShortGuid()}",
.Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT),
.Location = location, .Location = location,
@ -280,35 +296,88 @@ Public Class ClassControlCreator
' ----------------------- EXISITING CONTROLS ----------------------- ' ----------------------- EXISITING CONTROLS -----------------------
Public Shared Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As TextBox 'Public Shared Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As TextBox
' Try
' Dim control As TextBox = CreateBaseControl(New TextBox(), oControlRow, designMode)
' control.BackColor = Color.White
' If oControlRow.Item("HEIGHT") > 27 Then
' control.Multiline = True
' End If
' control.Height = oControlRow.Item("HEIGHT")
' control.Width = oControlRow.Item("WIDTH")
' If Not designMode Then
' control.AcceptsReturn = True
' control.ReadOnly = oControlRow.Item("READ_ONLY")
' control.TabStop = Not oControlRow.Item("READ_ONLY")
' control.BackColor = IIf(oControlRow.Item("READ_ONLY"), Color.LightGray, Color.White)
' control.ScrollBars = ScrollBars.Vertical
' Else
' control.ReadOnly = True
' End If
' Return control
' Catch ex As Exception
' Logger.Error(ex)
' End Try
'End Function
Public Shared Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As TextEdit
Try Try
Dim control As TextBox = CreateBaseControl(New TextBox(), oControlRow, designMode) Dim oControl As TextEdit = CreateBaseControl(New TextEdit(), oControlRow, designMode)
Dim oMeta As ControlMetadata = oControl.Tag
control.BackColor = Color.White oControl.BackColor = Color.White
oMeta.BackColor = Color.White
If oControlRow.Item("HEIGHT") > 27 Then ' TODO: Add separate function for MultilineEdit
control.Multiline = True 'If oControlRow.Item("HEIGHT") > 27 Then
' control.Multiline = True
'End If
End If Dim oHeight = oControlRow.ItemEx("HEIGHT", 0)
Dim oWidth = oControlRow.ItemEx("WIDTH", 0)
Dim oReadOnly = oControlRow.ItemEx("READ_ONLY", False)
Dim oFormatString = oControlRow.ItemEx("FORMAT_STRING", String.Empty)
Dim oBackColorIf = oControlRow.ItemEx("CTRL_BACKCOLOR_IF", String.Empty)
control.Height = oControlRow.Item("HEIGHT") oControl.Height = oHeight
control.Width = oControlRow.Item("WIDTH") oControl.Width = oWidth
If Not designMode Then If Not designMode Then
control.AcceptsReturn = True oControl.ReadOnly = oReadOnly
control.ReadOnly = oControlRow.Item("READ_ONLY") oControl.TabStop = Not oReadOnly
control.TabStop = Not oControlRow.Item("READ_ONLY") oControl.BackColor = IIf(oReadOnly, Color.LightGray, Color.White)
control.BackColor = IIf(oControlRow.Item("READ_ONLY"), Color.LightGray, Color.White)
control.ScrollBars = ScrollBars.Vertical ' If there is a format string defined, set it for display only.
' Editing will be without format string, according to current user-culture.
If oFormatString <> String.Empty Then
oControl.Properties.DisplayFormat.FormatType = FormatType.Custom
oControl.Properties.DisplayFormat.FormatString = ClassFormat.GetFormatString(oFormatString)
End If
' For read only controls, don't show the raw value when a user clicks into it
If oReadOnly Then
oControl.Properties.EditFormat.FormatType = FormatType.Custom
oControl.Properties.EditFormat.FormatString = ClassFormat.GetFormatString(oFormatString)
End If
'TODO: Find alternatives for TextEdit
'control.ScrollBars = ScrollBars.Vertical
'control.AcceptsReturn = True
Else Else
control.ReadOnly = True oControl.ReadOnly = True
End If End If
Return control Return oControl
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
End Try End Try
End Function End Function
Public Shared Function CreateExistingLabel(row As DataRow, designMode As Boolean) As Label Public Shared Function CreateExistingLabel(row As DataRow, designMode As Boolean) As Label

View File

@ -9,6 +9,26 @@ Public Class ClassFormat
Public Const DATE_FORMAT = "d" Public Const DATE_FORMAT = "d"
Public Const DATETIME_FORMAT = "G" Public Const DATETIME_FORMAT = "G"
Public Shared Function GetFormatString(pFormatString As String) As String
Select Case pFormatString
Case ClassControlCreator.CONTROL_TYPE_CURRENCY
Return CURRENCY_FORMAT
Case ClassControlCreator.CONTROL_TYPE_DOUBLE
Return DECIMAL_FORMAT
Case ClassControlCreator.CONTROL_TYPE_DATE
Return DATE_FORMAT
Case ClassControlCreator.CONTROL_TYPE_DATETIME
Return DATETIME_FORMAT
Case Else
Return String.Empty
End Select
End Function
Public Shared Function GetFormattedValue(pControlName As String, pValueObject As Object, pFormatString As String) As String Public Shared Function GetFormattedValue(pControlName As String, pValueObject As Object, pFormatString As String) As String
Try Try
If pFormatString <> String.Empty Then If pFormatString <> String.Empty Then

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("TaskFlow")> <Assembly: AssemblyProduct("TaskFlow")>
<Assembly: AssemblyCopyright("Copyright © Digital Data 2023")> <Assembly: AssemblyCopyright("Copyright © Digital Data 2023")>
<Assembly: AssemblyTrademark("2.4.2.2")> <Assembly: AssemblyTrademark("2.4.3.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.2.2")> <Assembly: AssemblyVersion("2.4.3.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -10,6 +10,7 @@ Imports DigitalData.Modules.Language
Imports System.Drawing Imports System.Drawing
Imports DigitalData.GUIs.Common Imports DigitalData.GUIs.Common
Imports DevExpress.Utils.Filtering.Internal Imports DevExpress.Utils.Filtering.Internal
Imports DevExpress.XtraEditors
Public Class frmFormDesigner Public Class frmFormDesigner
Public ProfileId As Integer Public ProfileId As Integer
@ -256,7 +257,7 @@ Public Class frmFormDesigner
' Jetzt die Control spezifischen Eigenschaften zuweisen ' Jetzt die Control spezifischen Eigenschaften zuweisen
Select Case row.Item("CTRL_TYPE") Select Case row.Item("CTRL_TYPE")
Case "TXT" Case ClassControlCreator.PREFIX_TEXTBOX
Dim txt = ClassControlCreator.CreateExistingTextbox(row, True) Dim txt = ClassControlCreator.CreateExistingTextbox(row, True)
pnldesigner.Controls.Add(txt) pnldesigner.Controls.Add(txt)
SetMovementHandlers(txt) SetMovementHandlers(txt)
@ -343,7 +344,7 @@ Public Class frmFormDesigner
If oMetadata.ReadOnly = False Then If oMetadata.ReadOnly = False Then
Dim Type As String = oControl.GetType.ToString Dim Type As String = oControl.GetType.ToString
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
oControl.BackColor = Color.White oControl.BackColor = Color.White
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
oControl.BackColor = Color.White oControl.BackColor = Color.White
@ -664,8 +665,8 @@ Public Class frmFormDesigner
checkProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), "")) checkProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
checkProps.SetControlData = New SQLValue(NotNull(oRow.Item("SET_CONTROL_DATA"), "")) checkProps.SetControlData = New SQLValue(NotNull(oRow.Item("SET_CONTROL_DATA"), ""))
props = checkProps props = checkProps
ElseIf TypeOf sender Is TextBox Then ElseIf TypeOf sender Is TextEdit Then
Dim txt As TextBox = sender Dim txt As TextEdit = sender
Dim txtProps As TextboxProperties = CreatePropsObjectWithIndicies(New TextboxProperties, oRow, Source_AllIndicies) Dim txtProps As TextboxProperties = CreatePropsObjectWithIndicies(New TextboxProperties, oRow, Source_AllIndicies)
txtProps.Regex = NotNull(oRow.Item("REGEX_MATCH"), String.Empty) txtProps.Regex = NotNull(oRow.Item("REGEX_MATCH"), String.Empty)
txtProps.RegexMessage = NotNull(oRow.Item("REGEX_MESSAGE_DE"), String.Empty) txtProps.RegexMessage = NotNull(oRow.Item("REGEX_MESSAGE_DE"), String.Empty)
@ -676,8 +677,8 @@ Public Class frmFormDesigner
props = txtProps props = txtProps
ElseIf TypeOf sender Is ComboBox Then ElseIf TypeOf sender Is Windows.Forms.ComboBox Then
Dim cmb As ComboBox = sender Dim cmb As Windows.Forms.ComboBox = sender
Dim cmbProps As ComboboxProperties = CreatePropsObjectWithIndicies(New ComboboxProperties, oRow, Source_AllIndicies) Dim cmbProps As ComboboxProperties = CreatePropsObjectWithIndicies(New ComboboxProperties, oRow, Source_AllIndicies)
cmbProps.ChoiceLists = Windream_ChoiceLists cmbProps.ChoiceLists = Windream_ChoiceLists
cmbProps.ChoiceList = NotNull(oRow.Item("CHOICE_LIST"), String.Empty) cmbProps.ChoiceList = NotNull(oRow.Item("CHOICE_LIST"), String.Empty)
@ -1286,9 +1287,10 @@ Public Class frmFormDesigner
If CurrentControl Is Nothing = False Then If CurrentControl Is Nothing = False Then
Dim newHeight As Integer = CurrentControl.Height - 5 Dim newHeight As Integer = CurrentControl.Height - 5
If newHeight < 22 And TypeOf CurrentControl Is TextBox Then ' TODO: Implement Multiline TextBox
DirectCast(CurrentControl, TextBox).Multiline = True 'If newHeight < 22 And TypeOf CurrentControl Is TextBox Then
End If ' DirectCast(CurrentControl, TextBox).Multiline = True
'End If
' Verhindert, dass das Control unsichtbar wird ' Verhindert, dass das Control unsichtbar wird
If newHeight < 1 Then If newHeight < 1 Then
@ -1307,9 +1309,10 @@ Public Class frmFormDesigner
If CurrentControl Is Nothing = False Then If CurrentControl Is Nothing = False Then
Dim newHeight As Integer = CurrentControl.Height + 5 Dim newHeight As Integer = CurrentControl.Height + 5
If newHeight > 21 And TypeOf CurrentControl Is TextBox Then ' TODO: Implement Multiline Textbox
DirectCast(CurrentControl, TextBox).Multiline = True 'If newHeight > 21 And TypeOf CurrentControl Is TextBox Then
End If ' DirectCast(CurrentControl, TextBox).Multiline = True
'End If
CurrentControl.Size = New Size(CurrentControl.Width, newHeight) CurrentControl.Size = New Size(CurrentControl.Width, newHeight)
DirectCast(pgControlsNew.SelectedObject, BaseProperties).Size = CurrentControl.Size DirectCast(pgControlsNew.SelectedObject, BaseProperties).Size = CurrentControl.Size

View File

@ -7,6 +7,7 @@ Imports DigitalData.Modules.Language.Utils
Imports System.IO Imports System.IO
Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback
Imports DigitalData.Modules.EDMI.API.Constants Imports DigitalData.Modules.EDMI.API.Constants
Imports DevExpress.XtraEditors
Public Class frmMassValidator Public Class frmMassValidator
Private DTCONTROLS As DataTable Private DTCONTROLS As DataTable
@ -143,9 +144,9 @@ Public Class frmMassValidator
Dim oControl As Control Dim oControl As Control
oLastControl = $"CtrlName {oControlRow.Item("NAME")}, CtrlIndexname: {oControlRow.Item("INDEX_NAME")}" oLastControl = $"CtrlName {oControlRow.Item("NAME")}, CtrlIndexname: {oControlRow.Item("INDEX_NAME")}"
Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper
Case "TXT" Case ClassControlCreator.PREFIX_TEXTBOX
LOGGER.Debug("Versuch TXT zu laden") LOGGER.Debug("Versuch TXT zu laden")
Dim txt As TextBox = ClassControlCreator.CreateExistingTextbox(oControlRow, False) Dim txt As TextEdit = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
AddHandler txt.GotFocus, AddressOf OnTextBoxFocus AddHandler txt.GotFocus, AddressOf OnTextBoxFocus
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
@ -473,7 +474,7 @@ Public Class frmMassValidator
LOGGER.Debug("INDEX: " & idxname & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString) LOGGER.Debug("INDEX: " & idxname & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString)
Dim wertWD Dim wertWD
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
Try Try
controltype = "Textbox" controltype = "Textbox"
If idxname = "" Then If idxname = "" Then
@ -509,7 +510,7 @@ Public Class frmMassValidator
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
controltype = "ComboBox" controltype = "ComboBox"
Dim cmb As ComboBox = oControl Dim cmb As Windows.Forms.ComboBox = oControl
If idxname = "" Then If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For Exit For
@ -838,16 +839,16 @@ Public Class frmMassValidator
End Function End Function
Public Sub OnTextBoxFocus(sender As Object, e As EventArgs) Public Sub OnTextBoxFocus(sender As Object, e As EventArgs)
Dim box As TextBox = sender Dim box As TextEdit = sender
box.BackColor = Color.LightSteelBlue box.BackColor = Color.LightSteelBlue
box.SelectAll() box.SelectAll()
End Sub End Sub
Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs) Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs)
Dim box As TextBox = sender Dim box As TextEdit = sender
box.BackColor = Color.White box.BackColor = Color.White
End Sub End Sub
Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs) Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs)
Dim box As TextBox = sender Dim box As TextEdit = sender
If box.Text <> String.Empty And me_closing = False And CTRLS_Loaded = True And FORM_Shown = True Then If box.Text <> String.Empty And me_closing = False And CTRLS_Loaded = True And FORM_Shown = True Then
If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then
@ -908,7 +909,7 @@ Public Class frmMassValidator
If displayboxname.StartsWith(ClassControlCreator.PREFIX_COMBOBOX) Then If displayboxname.StartsWith(ClassControlCreator.PREFIX_COMBOBOX) Then
LOGGER.Debug("Filling Combobox with Results") LOGGER.Debug("Filling Combobox with Results")
Dim oCombobox As ComboBox = pnldesigner.Controls(displayboxname) Dim oCombobox As Windows.Forms.ComboBox = pnldesigner.Controls(displayboxname)
If IsNothing(oCombobox) Then If IsNothing(oCombobox) Then
Exit Sub Exit Sub
@ -1097,7 +1098,7 @@ Public Class frmMassValidator
End If End If
Dim oValue Dim oValue
If TypeOf control Is TextBox Then If TypeOf control Is TextEdit Then
Try Try
Dim firstRow As DataRow = dt.Rows(0) Dim firstRow As DataRow = dt.Rows(0)
Dim value = firstRow.Item(0) Dim value = firstRow.Item(0)
@ -1108,9 +1109,9 @@ Public Class frmMassValidator
LOGGER.Error(ex) LOGGER.Error(ex)
clsLogger.Add("Error in LoadSimpleData for TextBox: " & ex.Message) clsLogger.Add("Error in LoadSimpleData for TextBox: " & ex.Message)
End Try End Try
ElseIf TypeOf control Is ComboBox Then ElseIf TypeOf control Is Windows.Forms.ComboBox Then
Try Try
Dim comboxBox As ComboBox = control Dim comboxBox As Windows.Forms.ComboBox = control
Dim list As New List(Of String) Dim list As New List(Of String)
For Each _row As DataRow In dt.Rows For Each _row As DataRow In dt.Rows
@ -1223,7 +1224,7 @@ Public Class frmMassValidator
'###### '######
Dim Type As String = oControl.GetType.ToString Dim Type As String = oControl.GetType.ToString
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
Try Try
value_from_control = oControl.Text value_from_control = oControl.Text
Catch ex As Exception Catch ex As Exception
@ -1521,7 +1522,7 @@ Public Class frmMassValidator
Catch ex As Exception Catch ex As Exception
LOGGER.Error(ex) LOGGER.Error(ex)
End Try End Try
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
Try Try
'Als erstes überprüfen ob überhaupt etwas eingetragen worden ist 'Als erstes überprüfen ob überhaupt etwas eingetragen worden ist
If Check_Missing(oControl, "txt") = True And _MUSSEINGABE = True Then 'NICHTS EINGETRAGEN If Check_Missing(oControl, "txt") = True And _MUSSEINGABE = True Then 'NICHTS EINGETRAGEN
@ -1742,11 +1743,14 @@ Public Class frmMassValidator
Function Check_Missing(control As Control, typ As String) Function Check_Missing(control As Control, typ As String)
Select Case typ Select Case typ
Case "txt" Case "txt"
If control.Text = String.Empty Or control.Text = "(Different values)" Or control.Text = "(Untersch. Werte)" Then Dim oTextBox As TextEdit = control
If oTextBox.Text = String.Empty Or oTextBox.Text = "(Different values)" Or oTextBox.Text = "(Untersch. Werte)" Then
Return True Return True
End If End If
Return False
End Select End Select
Return False
End Function End Function
Private Function IndexMultipleFiles(idxxname As String, idxvalue As Object) Private Function IndexMultipleFiles(idxxname As String, idxvalue As Object)

View File

@ -19,6 +19,8 @@ Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraBars Imports DevExpress.XtraBars
Imports DevExpress.XtraGrid.Columns Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraEditors
Imports DevExpress.Data
Public Class frmValidator Public Class frmValidator
Private Property Current_Document As DocumentResultList.Document = Nothing Private Property Current_Document As DocumentResultList.Document = Nothing
@ -741,7 +743,7 @@ Public Class frmValidator
End If End If
Dim oValue Dim oValue
If TypeOf control Is TextBox Then If TypeOf control Is TextEdit Then
Try Try
Dim firstRow As DataRow = oDTContent.Rows(0) Dim firstRow As DataRow = oDTContent.Rows(0)
@ -755,7 +757,7 @@ Public Class frmValidator
End Try End Try
ElseIf TypeOf control Is ComboBox Then ElseIf TypeOf control Is ComboBox Then
Try Try
Dim oMyComboBox As ComboBox = control Dim oMyComboBox As Windows.Forms.ComboBox = control
Dim oselectedIndex = oMyComboBox.SelectedIndex Dim oselectedIndex = oMyComboBox.SelectedIndex
LOGGER.Debug($"oMyComboBox {oMyComboBox.Name} - Saving selected index {oselectedIndex}") LOGGER.Debug($"oMyComboBox {oMyComboBox.Name} - Saving selected index {oselectedIndex}")
Dim list As New List(Of String) Dim list As New List(Of String)
@ -898,7 +900,7 @@ Public Class frmValidator
oControlInfo = ClassControlCreator.PREFIX_TEXTBOX & "#" & oControlInfo oControlInfo = ClassControlCreator.PREFIX_TEXTBOX & "#" & oControlInfo
LOGGER.Debug($"[{oControlInfo}] - TXT Try to create control...") LOGGER.Debug($"[{oControlInfo}] - TXT Try to create control...")
Dim txt As TextBox = ClassControlCreator.CreateExistingTextbox(oControlRow, False) Dim txt As TextEdit = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
AddHandler txt.GotFocus, AddressOf OnTextBoxFocus AddHandler txt.GotFocus, AddressOf OnTextBoxFocus
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp
@ -1177,7 +1179,7 @@ Public Class frmValidator
For Each inctrl As Control In Me.PanelValidatorControl.Controls For Each inctrl As Control In Me.PanelValidatorControl.Controls
Dim Type As String = inctrl.GetType.ToString Dim Type As String = inctrl.GetType.ToString
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
inctrl.Text = "" inctrl.Text = ""
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
Dim cmb As ComboBox = inctrl Dim cmb As ComboBox = inctrl
@ -1200,20 +1202,25 @@ Public Class frmValidator
End Sub End Sub
Public Sub OnTextBoxFocus(sender As Object, e As EventArgs) Public Sub OnTextBoxFocus(sender As Object, e As EventArgs)
Dim oTextbox As TextBox = sender Dim oTextbox As TextEdit = sender
Dim oMeta As ClassControlCreator.ControlMetadata = oTextbox.Tag
If DirectCast(oTextbox.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then If oMeta.ReadOnly = False Then
oTextbox.BackColor = Color.LightSteelBlue oTextbox.BackColor = Color.LightSteelBlue
oTextbox.ForeColor = GraphicsEx.GetContrastedColor(Color.LightSteelBlue)
oTextbox.SelectAll() oTextbox.SelectAll()
End If End If
End Sub End Sub
Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs) Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs)
Dim oTextbox As TextBox = sender Dim oTextbox As TextEdit = sender
Dim oMeta As ClassControlCreator.ControlMetadata = oTextbox.Tag
If DirectCast(oTextbox.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then If oMeta.ReadOnly = False Then
oTextbox.BackColor = Color.White oTextbox.BackColor = oMeta.BackColor
oTextbox.ForeColor = GraphicsEx.GetContrastedColor(oMeta.BackColor)
End If End If
SetControlValues_FromControl(oTextbox) SetControlValues_FromControl(oTextbox)
ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER)
@ -1232,7 +1239,7 @@ Public Class frmValidator
Exit Sub Exit Sub
End If End If
Dim oTextBox As TextBox = sender Dim oTextBox As TextEdit = sender
If oTextBox.Text <> String.Empty And me_closing = False And _Indexe_Loaded = True And oTextBox.Height < 25 Then If oTextBox.Text <> String.Empty And me_closing = False And _Indexe_Loaded = True And oTextBox.Height < 25 Then
If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then
@ -1668,7 +1675,7 @@ Public Class frmValidator
'End Try 'End Try
Select Case oControl.GetType() Select Case oControl.GetType()
Case GetType(TextBox) Case GetType(TextEdit)
If oControlTextOption = "Replace" Then If oControlTextOption = "Replace" Then
oControl.Text = oControlCaption oControl.Text = oControlCaption
Else Else
@ -1833,7 +1840,7 @@ Public Class frmValidator
oFound = True oFound = True
LOGGER.Debug($"Got the depending control ID:{oDEPENDING_GUID}..Setting the values..") LOGGER.Debug($"Got the depending control ID:{oDEPENDING_GUID}..Setting the values..")
Select Case oControl.GetType.ToString Select Case oControl.GetType.ToString
Case GetType(TextBox).ToString Case GetType(TextEdit).ToString
Try Try
Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0) Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0)
Try Try
@ -1958,7 +1965,7 @@ Public Class frmValidator
oFound = True oFound = True
LOGGER.Debug($"Got the depending control ID:{oDEPENDING_GUID}..Setting the values..") LOGGER.Debug($"Got the depending control ID:{oDEPENDING_GUID}..Setting the values..")
Select Case oControl.GetType.ToString Select Case oControl.GetType.ToString
Case GetType(TextBox).ToString Case GetType(TextEdit).ToString
Try Try
Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0) Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0)
Try Try
@ -2336,7 +2343,7 @@ Public Class frmValidator
If displayboxname.StartsWith(ClassControlCreator.PREFIX_COMBOBOX) Then If displayboxname.StartsWith(ClassControlCreator.PREFIX_COMBOBOX) Then
LOGGER.Debug("Filling Combobox with Results") LOGGER.Debug("Filling Combobox with Results")
Dim oCombobox As ComboBox = PanelValidatorControl.Controls(displayboxname) Dim oCombobox As Windows.Forms.ComboBox = PanelValidatorControl.Controls(displayboxname)
If IsNothing(oCombobox) Then If IsNothing(oCombobox) Then
Exit Sub Exit Sub
@ -3137,13 +3144,14 @@ Public Class frmValidator
oControName = oControl.Name oControName = oControl.Name
Dim oLoadIndex As Boolean = oControlRow.Item("LOAD_IDX_VALUE") Dim oLoadIndex As Boolean = oControlRow.Item("LOAD_IDX_VALUE")
LOGGER.Debug("INDEX: " & oSourceIndexName & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & oLoadIndex.ToString) LOGGER.Debug("INDEX: " & oSourceIndexName & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & oLoadIndex.ToString)
Select Case oType Select Case oType
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
Try Try
oControlType = "Textbox" oControlType = "Textbox"
Dim oTextBox As TextEdit = oControl
Dim oMeta As ClassControlCreator.ControlMetadata = oTextBox.Tag
If oSourceIndexName = "" Then If oSourceIndexName = "" Then
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For Exit For
@ -3151,7 +3159,7 @@ Public Class frmValidator
If oSourceIndexName Is Nothing = False Then If oSourceIndexName Is Nothing = False Then
If oLoadIndex = False Or oSourceIndexName = "DD PM-ONLY FOR DISPLAY" Then If oLoadIndex = False Or oSourceIndexName = "DD PM-ONLY FOR DISPLAY" Then
' Wenn kein Index exisitiert, defaultValue laden ' Wenn kein Index exisitiert, defaultValue laden
oControl.Text = oDefaultValue oTextBox.EditValue = oDefaultValue
LOGGER.Debug("Indexwert soll nicht geladen werden.") LOGGER.Debug("Indexwert soll nicht geladen werden.")
Exit Select Exit Select
End If End If
@ -3186,14 +3194,15 @@ Public Class frmValidator
End If End If
Try Try
Dim oFormatString As String = oControlRow.ItemEx("CTRL_FORMAT_STRING", "") 'Dim oFormatString As String = oControlRow.ItemEx("CTRL_FORMAT_STRING", "")
oFormattedValue = ClassFormat.GetFormattedValue(oControl.Name, oValueFromSource, oFormatString) 'oFormattedValue = ClassFormat.GetFormattedValue(oControl.Name, oValueFromSource, oFormatString)
If Not IsNothing(oFormattedValue) And oFormattedValue <> String.Empty Then If Not IsNothing(oFormattedValue) And oFormattedValue <> String.Empty Then
oControl.Text = NotNull(oFormattedValue, oDefaultValue) oTextBox.EditValue = NotNull(oFormattedValue, oDefaultValue)
Else Else
oControl.Text = NotNull(oValueFromSource, oDefaultValue) oTextBox.EditValue = NotNull(oValueFromSource, oDefaultValue)
End If End If
Try Try
Dim oBackColor As String = oControlRow.Item("CTRL_BACKCOLOR_IF") Dim oBackColor As String = oControlRow.Item("CTRL_BACKCOLOR_IF")
If oBackColor <> String.Empty Then If oBackColor <> String.Empty Then
@ -3209,14 +3218,11 @@ Public Class frmValidator
Dim oSQl = $"SELECT CASE WHEN {oExpression} THEN CONVERT(BIT,1) ELSE CONVERT(BIT,0) END " Dim oSQl = $"SELECT CASE WHEN {oExpression} THEN CONVERT(BIT,1) ELSE CONVERT(BIT,0) END "
Dim oColorName = IIf(DatabaseECM.GetScalarValue(oSQl), oSPlit(1), oSPlit(2)) Dim oColorName = IIf(DatabaseECM.GetScalarValue(oSQl), oSPlit(1), oSPlit(2))
oControl.BackColor = Color.FromName(oColorName) oControl.BackColor = Color.FromName(oColorName)
oMeta.BackColor = oControl.BackColor
oControl.ForeColor = GraphicsEx.GetContrastedColor(oControl.BackColor) oControl.ForeColor = GraphicsEx.GetContrastedColor(oControl.BackColor)
'If oColorName = "Green" Or oColorName = "Blue" Or oColorName = "Red" Then
' oControl.ForeColor = Color.FromName("White")
'Else
' oControl.ForeColor = Color.FromName("Black")
'End If
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
@ -3230,7 +3236,7 @@ Public Class frmValidator
Catch ex As Exception Catch ex As Exception
LOGGER.Info("Error While converting defaultValue [" & oDefaultValue & "]: " & ex.Message) LOGGER.Info("Error While converting defaultValue [" & oDefaultValue & "]: " & ex.Message)
oControl.Text = "" oTextBox.EditValue = ""
End Try End Try
@ -3248,7 +3254,7 @@ Public Class frmValidator
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
oControlType = "ComboBox" oControlType = "ComboBox"
Dim oMyCombobox As ComboBox = oControl Dim oMyCombobox As Windows.Forms.ComboBox = oControl
Try Try
If oSourceIndexName = "" Then If oSourceIndexName = "" Then
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
@ -4294,7 +4300,7 @@ Public Class frmValidator
'###### '######
Dim Type As String = oControl.GetType.ToString Dim Type As String = oControl.GetType.ToString
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
Try Try
value_from_control = oControl.Text value_from_control = oControl.Text
Catch ex As Exception Catch ex As Exception
@ -4450,14 +4456,16 @@ Public Class frmValidator
btnSave.Enabled = True btnSave.Enabled = True
End Sub End Sub
Function Check_Missing(control As Control, typ As String) Function Check_Missing(control As Control, typ As String) As Boolean
Select Case typ Select Case typ
Case "txt" Case "txt"
If control.Text = String.Empty Then Dim oTextBox As TextEdit = control
If oTextBox.Text = String.Empty Then
Return True Return True
End If End If
Return False
End Select End Select
Return False
End Function End Function
Function Return_PM_VEKTOR(input As String, VKTBezeichner As String) Function Return_PM_VEKTOR(input As String, VKTBezeichner As String)
Dim PM_String As String Dim PM_String As String
@ -4774,7 +4782,7 @@ Public Class frmValidator
End Try End Try
Case "System.Windows.Forms.TextBox" Case "DevExpress.XtraEditors.TextEdit"
Try Try
'Dim oWrongInputMessage = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.WrongInputControl") 'Dim oWrongInputMessage = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.WrongInputControl")
Dim oWrongInputMessage = S.Falsche_Eingabe Dim oWrongInputMessage = S.Falsche_Eingabe
@ -4899,7 +4907,7 @@ Public Class frmValidator
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
Try Try
LOGGER.Debug($"Working on Combobox...") LOGGER.Debug($"Working on Combobox...")
Dim cmb As ComboBox = oControl Dim cmb As Windows.Forms.ComboBox = oControl
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss 'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
If cmb.SelectedIndex = -1 And oIsRequired = True Then If cmb.SelectedIndex = -1 And oIsRequired = True Then
oMissing = True oMissing = True