This commit is contained in:
Jonathan Jenne
2017-06-23 16:11:10 +02:00
parent 0f8f8ddf65
commit f24d8ba4cb
8 changed files with 71 additions and 33 deletions

View File

@@ -1380,9 +1380,6 @@ Public Class ClassControlBuilder
Try Try
Dim control As Label = New Label Dim control As Label = New Label
Dim defaultSize As Size = New Size(200, 27) Dim defaultSize As Size = New Size(200, 27)
If id = 735 Then
Dim i = "Obacht"
End If
Dim metadata As New ClassControlMetadata() Dim metadata As New ClassControlMetadata()
metadata.Id = id metadata.Id = id
metadata.Name = name metadata.Name = name
@@ -1468,6 +1465,7 @@ Public Class ClassControlBuilder
read_only As Boolean, read_only As Boolean,
required As Boolean, required As Boolean,
format As String, format As String,
autoSuggest As Boolean,
_new As Boolean, _new As Boolean,
Optional parent As GroupBox = Nothing, Optional parent As GroupBox = Nothing,
Optional _designMode As Boolean = False) Optional _designMode As Boolean = False)
@@ -1495,6 +1493,20 @@ Public Class ClassControlBuilder
'Console.WriteLine("setting tabindex of control " & name & " to " & tabindex) 'Console.WriteLine("setting tabindex of control " & name & " to " & tabindex)
If autoSuggest = True Then
control.AutoCompleteMode = AutoCompleteMode.Suggest
control.AutoCompleteSource = AutoCompleteSource.CustomSource
Dim suggestSource As New AutoCompleteStringCollection()
Dim dt As DataTable = ClassDatabase.Return_Datatable($"SELECT DISTINCT VALUE FROM VWPMO_VALUES WHERE CONTROL_ID = {id}")
For Each row As DataRow In dt.Rows
suggestSource.Add(row.Item("VALUE"))
Next
control.AutoCompleteCustomSource = suggestSource
End If
If multiline = True Then If multiline = True Then
control.Multiline = True control.Multiline = True
control.AcceptsReturn = True control.AcceptsReturn = True

View File

@@ -196,9 +196,9 @@
End Function End Function
Public Shared Function UpdateControl(control As Control, properties As Object) Public Shared Function UpdateControl(control As Control, properties As Object)
' Try Try
' Nach Typ den Update Befehl anpassen ' Nach Typ den Update Befehl anpassen
Dim type As String = control.GetType.Name Dim type As String = control.GetType.Name
Dim SQL As String Dim SQL As String
Dim NAME As String Dim NAME As String
@@ -208,7 +208,7 @@
Dim CHANGED_WHO As String = USER_USERNAME Dim CHANGED_WHO As String = USER_USERNAME
Dim COL_NAME As String Dim COL_NAME As String
Dim SQLCommand As String Dim SQLCommand As String
Dim EnabledWhen As String Dim SQL_ENABLED_WHEN As String
Dim MULTILINE As Integer Dim MULTILINE As Integer
Dim MASTER_DATA_ID As Integer Dim MASTER_DATA_ID As Integer
Dim DEFAULTVALUE As String Dim DEFAULTVALUE As String
@@ -217,6 +217,8 @@
Dim STATIC_LIST As String Dim STATIC_LIST As String
Dim VISIBLE As Integer Dim VISIBLE As Integer
Dim TREE_VIEW As Integer Dim TREE_VIEW As Integer
Dim AUTO_SUGGEST As Integer
' So sollte diese Funktion später mal aussehen :( ' So sollte diese Funktion später mal aussehen :(
'Select Case type 'Select Case type
@@ -242,6 +244,12 @@
MULTILINE = 0 MULTILINE = 0
End If End If
If propExists(properties, "AutoSuggest") Then
AUTO_SUGGEST = BoolToInt(properties.AutoSuggest)
Else
AUTO_SUGGEST = 0
End If
If propExists(properties, "ColumnTitle") Then If propExists(properties, "ColumnTitle") Then
COL_NAME = properties.ColumnTitle COL_NAME = properties.ColumnTitle
Else Else
@@ -307,12 +315,12 @@
If propExists(properties, "EnabledWhen") Then If propExists(properties, "EnabledWhen") Then
Dim value As SQLValue = DirectCast(properties.EnabledWhen, SQLValue) Dim value As SQLValue = DirectCast(properties.EnabledWhen, SQLValue)
EnabledWhen = value.Value SQL_ENABLED_WHEN = value.Value
If EnabledWhen.Contains("'") Then If SQL_ENABLED_WHEN.Contains("'") Then
EnabledWhen = EnabledWhen.Replace("'", "''") SQL_ENABLED_WHEN = SQL_ENABLED_WHEN.Replace("'", "''")
End If End If
Else Else
EnabledWhen = String.Empty SQL_ENABLED_WHEN = String.Empty
End If End If
If propExists(properties, "StaticList") Then If propExists(properties, "StaticList") Then
@@ -333,33 +341,21 @@
CURRENT_CONTROL_ID = properties.ID CURRENT_CONTROL_ID = properties.ID
End If End If
SQL = String.Format( SQL = $"UPDATE TBPMO_CONTROL SET REQUIRED = {REQUIRED}, READ_ONLY = {READ_ONLY}, SHOW_COLUMN = {SHOW_COLUMN}, FORMAT_TYPE = '{FORMAT_TYPE}', DEFAULT_VALUE = '{DEFAULTVALUE}',
"UPDATE TBPMO_CONTROL SET REQUIRED = {0}, READ_ONLY = {1}, SHOW_COLUMN = {2}, FORMAT_TYPE = '{3}', DEFAULT_VALUE = '{4}', " & NAME = '{NAME}', SQL_COMMAND_1 = '{SQLCommand}', CHANGED_WHO = '{CHANGED_WHO}', COL_NAME = '{COL_NAME}', MULTILINE = {MULTILINE}, MASTER_DATA_ID = {MASTER_DATA_ID},
"NAME = '{5}', SQL_COMMAND_1 = '{6}', CHANGED_WHO = '{7}', COL_NAME = '{8}', MULTILINE = {9}, MASTER_DATA_ID = {10}, " & STATIC_LIST = '{STATIC_LIST}', SQL_COMMAND_2 = '{SQL_ENABLED_WHEN}', VISIBLE = {VISIBLE}, TREE_VIEW = {TREE_VIEW}, SELECT_ONLY = {SELECT_ONLY}, AUTO_SUGGEST = {AUTO_SUGGEST}
"STATIC_LIST = '{11}', SQL_COMMAND_2 = '{12}', VISIBLE = {13}, TREE_VIEW = {14}, SELECT_ONLY = {15} " & WHERE GUID = {CURRENT_CONTROL_ID}"
"WHERE GUID = {16}",
REQUIRED, READ_ONLY, SHOW_COLUMN, FORMAT_TYPE, DEFAULTVALUE,
NAME, SQLCommand, CHANGED_WHO, COL_NAME, MULTILINE, MASTER_DATA_ID,
STATIC_LIST, EnabledWhen, VISIBLE, TREE_VIEW, SELECT_ONLY,
CURRENT_CONTROL_ID
)
'SQL = "UPDATE TBPMO_CONTROL SET REQUIRED = " & REQUIRED & ", READ_ONLY = " & READ_ONLY & ", SHOW_COLUMN = " & SHOW_COLUMN & _
' ", FORMAT_TYPE = '" & FORMAT_TYPE & "', DEFAULT_VALUE = '" & DEFAULTVALUE & "', NAME = '" & NAME & "', SQL_COMMAND_1 = '" & SQLCommand & _
' "', CHANGED_WHO = '" & CHANGED_WHO & "', COL_NAME = '" & COL_NAME & "', MULTILINE = " & MULTILINE & ", MASTER_DATA_ID = " & MASTER_DATA_ID & _
' ", STATIC_LIST = '" & STATIC_LIST & "', SQL_COMMAND_2 = '" & EnabledWhen & "', VISIBLE = " & VISIBLE & ", TREE_VIEW = " & TREE_VIEW & _
' " WHERE GUID = " & CURRENT_CONTROL_ID
If ClassDatabase.Execute_non_Query(SQL) = True Then If ClassDatabase.Execute_non_Query(SQL) = True Then
Return UpdateControlScreen(control, properties) Return UpdateControlScreen(control, properties)
Else Else
Throw New Exception() Throw New Exception()
End If End If
'Catch ex As Exception Catch ex As Exception
' ClassLogger.Add("Unexpected Error in UpdateControl: " & ex.Message, True) ClassLogger.Add("Unexpected Error in UpdateControl: " & ex.Message, True)
' MsgBox("Unexpected Error in UpdateControl:" + vbNewLine + ex.Message, MsgBoxStyle.Critical) MsgBox("Unexpected Error in UpdateControl:" + vbNewLine + ex.Message, MsgBoxStyle.Critical)
' Return False Return False
'End Try End Try
End Function End Function
Public Shared Function UpdateControlScreen(control As Control, properties As Object) Public Shared Function UpdateControlScreen(control As Control, properties As Object)

View File

@@ -93,6 +93,7 @@ Public Class ClassControlCommandsUI
dr.Item("CONTROL_READ_ONLY"), dr.Item("CONTROL_READ_ONLY"),
dr.Item("CONTROL_REQUIRED"), dr.Item("CONTROL_REQUIRED"),
dr.Item("CONTROL_FORMAT_TYPE"), dr.Item("CONTROL_FORMAT_TYPE"),
dr.Item("CONTROL_AUTO_SUGGEST"),
False, False,
parent) parent)
control = "Text - " & dr.Item("CONTROL_ID") control = "Text - " & dr.Item("CONTROL_ID")

View File

@@ -332,6 +332,7 @@ Module ClassControlProperties
Inherits InputControlProperties Inherits InputControlProperties
Private _multiline As Boolean Private _multiline As Boolean
Private _autosuggest As Boolean
Private _format As String Private _format As String
<LocalizedCategoryAttribute("category_view")> <LocalizedCategoryAttribute("category_view")>
@@ -355,6 +356,17 @@ Module ClassControlProperties
_multiline = value _multiline = value
End Set End Set
End Property End Property
<LocalizedCategoryAttribute("category_view")>
<LocalizedDescription("desc_autosuggest")>
Public Property AutoSuggest() As Boolean
Get
Return _autosuggest
End Get
Set(value As Boolean)
_autosuggest = value
End Set
End Property
End Class End Class
Public Class ComboBoxProperties Public Class ComboBoxProperties
Inherits InputControlProperties Inherits InputControlProperties

View File

@@ -145,6 +145,15 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Schlägt bereits eingegebene Einträge bei der der Eingabe vor. ähnelt.
'''</summary>
Friend Shared ReadOnly Property desc_autosuggest() As String
Get
Return ResourceManager.GetString("desc_autosuggest", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Gibt die Hintergrundfarbe des Elements an. ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Gibt die Hintergrundfarbe des Elements an. ähnelt.
'''</summary> '''</summary>

View File

@@ -144,6 +144,9 @@
<data name="category_view" xml:space="preserve"> <data name="category_view" xml:space="preserve">
<value>View Configuration</value> <value>View Configuration</value>
</data> </data>
<data name="desc_autosuggest" xml:space="preserve">
<value>Suggests already entered entries</value>
</data>
<data name="desc_backcolor" xml:space="preserve"> <data name="desc_backcolor" xml:space="preserve">
<value>The element's background color.</value> <value>The element's background color.</value>
</data> </data>

View File

@@ -144,6 +144,9 @@
<data name="category_view" xml:space="preserve"> <data name="category_view" xml:space="preserve">
<value>Ansichts Einstellungen</value> <value>Ansichts Einstellungen</value>
</data> </data>
<data name="desc_autosuggest" xml:space="preserve">
<value>Schlägt bereits eingegebene Einträge bei der der Eingabe vor.</value>
</data>
<data name="desc_backcolor" xml:space="preserve"> <data name="desc_backcolor" xml:space="preserve">
<value>Gibt die Hintergrundfarbe des Elements an.</value> <value>Gibt die Hintergrundfarbe des Elements an.</value>
</data> </data>

View File

@@ -51,7 +51,7 @@
' Aktuelles Control in die Datenbank speichern ' Aktuelles Control in die Datenbank speichern
ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl)
Case "txt" Case "txt"
DesignerCtrlBuilder.AddTextBox(0, "txt" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, False, False, False, "String", True, Parent) DesignerCtrlBuilder.AddTextBox(0, "txt" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, False, False, False, "String", False, True, Parent)
' Aktuelles Control in die Datenbank speichern ' Aktuelles Control in die Datenbank speichern
ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl)
Case "cmb" Case "cmb"
@@ -263,6 +263,7 @@
dr.Item("CONTROL_READ_ONLY"), dr.Item("CONTROL_READ_ONLY"),
dr.Item("CONTROL_REQUIRED"), dr.Item("CONTROL_REQUIRED"),
dr.Item("CONTROL_FORMAT_TYPE"), dr.Item("CONTROL_FORMAT_TYPE"),
dr.Item("CONTROL_AUTO_SUGGEST"),
False, False,
parent, parent,
True) True)
@@ -751,6 +752,7 @@
props.SQLCommand = New SQLValue(NotNull(r.Item("CONTROL_SQLCOMMAND_1"), "")) props.SQLCommand = New SQLValue(NotNull(r.Item("CONTROL_SQLCOMMAND_1"), ""))
props.EnabledWhen = New SQLValue(r.Item("CONTROL_SQLCOMMAND_2").ToString()) props.EnabledWhen = New SQLValue(r.Item("CONTROL_SQLCOMMAND_2").ToString())
props.TreeView = CBool(r.Item("CONTROL_TREE_VIEW")) props.TreeView = CBool(r.Item("CONTROL_TREE_VIEW"))
props.AutoSuggest = CBool(r.Item("CONTROL_AUTO_SUGGEST"))
Case "Combobox" Case "Combobox"
props.ControlType = "ComboBox" props.ControlType = "ComboBox"