This commit is contained in:
JenneJ
2016-08-24 15:06:55 +02:00
parent 08a93d1338
commit 8cac2cf09e
4 changed files with 128 additions and 33 deletions

View File

@@ -163,16 +163,64 @@ Public Class ClassControlBuilder
Public Sub OnTextBoxFocus(sender As Object, ByVal e As EventArgs) Public Sub OnTextBoxFocus(sender As Object, ByVal e As EventArgs)
Dim box As TextBox = sender Dim box As TextBox = sender
box.BackColor = Color.LemonChiffon box.BackColor = Color.LemonChiffon
box.SelectAll() box.SelectAll()
If CURRENT_RECORD_ENABLED = False Then Exit Sub
CURRENT_TEXTBOX_SELECTED_TEXT = DirectCast(sender, TextBox).Text
End Sub End Sub
Public Sub OnTextBoxLostFocus(sender As Object, ByVal e As EventArgs) Public Sub OnTextBoxLostFocus(sender As Object, ByVal e As EventArgs)
Dim box As TextBox = sender Dim box As TextBox = sender
box.BackColor = Color.White box.BackColor = Color.White
End Sub
Public Sub OnTextBoxTextChanged(sender As Object, ByVal e As EventArgs)
If CURRENT_RECORD_ENABLED = False Then Exit Sub
CURRENT_RECORD_ENABLED = False
Try
Dim control As Control = DirectCast(sender, Control)
Dim textbox As TextBox = DirectCast(control, TextBox)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CONTROL_ID = controlId
Dim expression As String
expression = "ENTITY_ID = " & CURRENT_FORM_ID
Dim foundControls() As DataRow
' Use the Select method to find all rows matching the filter.
foundControls = CURRENT_DT_TBPMO_ENTITY_RIGHT_CONTROLS.Select(expression)
Dim i As Integer
Dim NODE_CONFIG_ID
' Check if control is one of rightcontrols
For i = 0 To foundControls.GetUpperBound(0)
If foundControls(i)("CONTROL_ID") = CONTROL_ID Then
RIGHT_CONTROL_CHANGED = True
Dim msg = MSG_RIGHTMODULE_DE
If USER_LANGUAGE <> "de-DE" Then
msg = MSG_RIGHTMODULE_EN_US
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
CtrlBuilder.ControlsChanged.Remove(controlId)
' Y U NO WORK??
Dim text = CURRENT_TEXTBOX_SELECTED_TEXT
textbox.Text = text
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
End If
Next
Catch ex As Exception
If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then
Else
MsgBox("Error in OnTextBoxLostFocus - " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical)
End If
Finally
CURRENT_RECORD_ENABLED = True
End Try
End Sub End Sub
Public Sub OnComboBoxFocus(sender As Object, ByVal e As EventArgs) Public Sub OnComboBoxFocus(sender As Object, ByVal e As EventArgs)
Dim combo As CustomComboBox = sender Dim combo As CustomComboBox = sender
combo.BackColor = Color.LemonChiffon combo.BackColor = Color.LemonChiffon
@@ -489,16 +537,20 @@ Public Class ClassControlBuilder
Dim control As Control = DirectCast(sender, Control) Dim control As Control = DirectCast(sender, Control)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CURRENT_COMBOBOX_SELECTED_INDEX = DirectCast(control, CustomComboBox).SelectedIndex CURRENT_COMBOBOX_SELECTED_INDEX = DirectCast(control, CustomComboBox).SelectedIndex
CURRENT_COMBOBOX_SELECTED_TEXT = DirectCast(control, CustomComboBox).Text
Catch ex As Exception Catch ex As Exception
MsgBox("Error in OnComboBoxFocused - " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical) MsgBox("Error in OnComboBoxFocused - " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical)
End Try End Try
End Sub End Sub
Public Sub OnComboBoxValueChanged(sender As Object, ByVal e As EventArgs) Public Sub OnComboBoxValueChanged(sender As Object, ByVal e As EventArgs)
If CURRENT_RECORD_ENABLED = False Then Exit Sub If CURRENT_RECORD_ENABLED = False Then Exit Sub
' Verhindert, dass OnComboBoxFocues unkontrolliert feuert!
CURRENT_RECORD_ENABLED = False
Try Try
Dim control As Control = DirectCast(sender, Control) Dim control As Control = DirectCast(sender, Control)
Dim combo As CustomComboBox = DirectCast(control, CustomComboBox)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CONTROL_ID = controlId CONTROL_ID = controlId
@@ -513,9 +565,35 @@ Public Class ClassControlBuilder
For i = 0 To foundControls.GetUpperBound(0) For i = 0 To foundControls.GetUpperBound(0)
If foundControls(i)("CONTROL_ID") = CONTROL_ID Then If foundControls(i)("CONTROL_ID") = CONTROL_ID Then
RIGHT_CONTROL_CHANGED = True RIGHT_CONTROL_CHANGED = True
Exit For Dim msg = MSG_RIGHTMODULE_DE
If USER_LANGUAGE <> "de-DE" Then
msg = MSG_RIGHTMODULE_EN_US
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
CtrlBuilder.ControlsChanged.Remove(controlId)
' Y U NO WORK??
Dim text = CURRENT_COMBOBOX_SELECTED_TEXT
combo.SelectedIndex = -1
combo.SelectedText = text
combo.Text = text
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
End If End If
Next Next
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
If Not ControlsChanged.Contains(controlId) Then
ControlsChanged.Add(controlId)
End If
If (onRecordChangedHandler IsNot Nothing And WatchRecordChanges) Then
onRecordChangedHandler.Invoke(sender, e)
End If
'SQL für abhängige Auswahllisten 'SQL für abhängige Auswahllisten
Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1, CONTROL_TYPE_ID,FORMAT_TYPE FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId) Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1, CONTROL_TYPE_ID,FORMAT_TYPE FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId)
Dim value Dim value
@@ -538,9 +616,11 @@ Public Class ClassControlBuilder
value = DirectCast(control, CustomComboBox).Text value = DirectCast(control, CustomComboBox).Text
If String.IsNullOrEmpty(value) Then If String.IsNullOrEmpty(value) Then
CURRENT_RECORD_ENABLED = True
Exit Sub Exit Sub
End If End If
If CURRENT_RECORD_ID = 0 And CtrlCommandUI.IsInsert = True Then If CURRENT_RECORD_ID = 0 And CtrlCommandUI.IsInsert = True Then
CURRENT_RECORD_ENABLED = True
Exit Sub Exit Sub
End If End If
@@ -549,7 +629,7 @@ Public Class ClassControlBuilder
Depending_Controls(control, datatable, value) Depending_Controls(control, datatable, value)
Enable_Controls(control, datatable1, value) Enable_Controls(control, datatable1, value)
Console.WriteLine("value changed") CURRENT_RECORD_ENABLED = True
Catch ex As Exception Catch ex As Exception
If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then
@@ -588,6 +668,12 @@ Public Class ClassControlBuilder
If result = MsgBoxResult.No Then If result = MsgBoxResult.No Then
RIGHT_CONTROL_CHANGED = False RIGHT_CONTROL_CHANGED = False
CtrlBuilder.ControlsChanged.Remove(controlId) CtrlBuilder.ControlsChanged.Remove(controlId)
Dim loadedValues As List(Of Object) = (From row In CURRENT_CONTROL_VALUES.AsEnumerable()
Where row.Item("CONTROL_ID") = controlId
Select row.Item("VALUE")).ToList()
ClassControlValues.LoadControlValue(CURRENT_RECORD_ID, CURRENT_PARENT_RECORD_ID, CONTROL_ID, control, loadedValues, CURRENT_FORM_ID)
RECORD_CHANGED = False RECORD_CHANGED = False
Exit Sub Exit Sub
End If End If
@@ -787,15 +873,15 @@ Public Class ClassControlBuilder
AddHandler textbox.TextChanged, AddressOf RecordChanged AddHandler textbox.TextChanged, AddressOf RecordChanged
AddHandler textbox.GotFocus, AddressOf OnTextBoxFocus AddHandler textbox.GotFocus, AddressOf OnTextBoxFocus
AddHandler textbox.LostFocus, AddressOf OnTextBoxLostFocus AddHandler textbox.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler textbox.TextChanged, AddressOf OnTextBoxTextChanged
AddHandler textbox.ReadOnlyChanged, AddressOf OnReadOnlyChanged AddHandler textbox.ReadOnlyChanged, AddressOf OnReadOnlyChanged
Case "CustomComboBox" Case "CustomComboBox"
Dim combo As CustomComboBox = CType(control, CustomComboBox) Dim combo As CustomComboBox = CType(control, CustomComboBox)
AddHandler combo.GotFocus, AddressOf OnComboBoxFocused 'AddHandler combo.GotFocus, AddressOf OnComboBoxFocused
AddHandler combo.SelectedValueChanged, AddressOf RecordChanged AddHandler combo.Enter, AddressOf OnComboBoxFocused
AddHandler combo.SelectedValueChanged, AddressOf OnComboBoxValueChanged AddHandler combo.SelectedValueChanged, AddressOf OnComboBoxValueChanged
AddHandler combo.TextChanged, AddressOf RecordChanged
'AddHandler combo.TextChanged, AddressOf RecordChanged
'AddHandler combo.GotFocus, AddressOf OnComboBoxFocus 'AddHandler combo.GotFocus, AddressOf OnComboBoxFocus
'AddHandler combo.LostFocus, AddressOf OnComboBoxLostFocus 'AddHandler combo.LostFocus, AddressOf OnComboBoxLostFocus
AddHandler combo.EnabledChanged, AddressOf OnEnabledChanged AddHandler combo.EnabledChanged, AddressOf OnEnabledChanged
@@ -2275,7 +2361,9 @@ Public Class ClassControlBuilder
Next Next
End If End If
Me.SetEventHandlers(control) If Not _designMode Then
Me.SetEventHandlers(control)
End If
Me.CurrentControl = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl) Me.CurrentControl = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
If Not IsNothing(parent) Then If Not IsNothing(parent) Then
control.Parent = parent control.Parent = parent

View File

@@ -431,6 +431,9 @@
Exit Sub Exit Sub
End If End If
CURRENT_RECORD_ENABLED = False
control.UnCheckAll()
For Each v As String In values For Each v As String In values
'For i As Integer = 0 To control.ItemCount - 1 'For i As Integer = 0 To control.ItemCount - 1
@@ -439,6 +442,7 @@
Dim posBefore As Integer = 0 Dim posBefore As Integer = 0
While (control.FindStringExact(v, posBefore) > -1) While (control.FindStringExact(v, posBefore) > -1)
Dim pos = control.FindStringExact(v, posBefore) Dim pos = control.FindStringExact(v, posBefore)
' Wenn v gefunden wurde, anhaken ' Wenn v gefunden wurde, anhaken
If pos >= 0 Then If pos >= 0 Then
control.SetItemCheckState(pos, CheckState.Checked) control.SetItemCheckState(pos, CheckState.Checked)
@@ -449,9 +453,9 @@
Exit While Exit While
End If End If
End While End While
Next Next
CURRENT_RECORD_ENABLED = True
End Sub End Sub
Public Shared Sub LoadList(control As DevExpress.XtraEditors.CheckedListBoxControl, formId As Integer, conn_Id As Object, SQLCommand As String) Public Shared Sub LoadList(control As DevExpress.XtraEditors.CheckedListBoxControl, formId As Integer, conn_Id As Object, SQLCommand As String)

View File

@@ -101,6 +101,8 @@
Public RECORD_CHANGED As Boolean = False Public RECORD_CHANGED As Boolean = False
Public CURRENT_COMBOBOX_SELECTED_INDEX As Integer = 0 Public CURRENT_COMBOBOX_SELECTED_INDEX As Integer = 0
Public CURRENT_COMBOBOX_SELECTED_TEXT As String = ""
Public CURRENT_TEXTBOX_SELECTED_TEXT As String = ""
Public RIGHT_CONTROL_CHANGED As Boolean = False Public RIGHT_CONTROL_CHANGED As Boolean = False
Public MSG_RIGHTMODULE_DE = "Achtung: " & vbNewLine & "Sie haben Änderungen an Rechte-relevanten Eingaben vorgenommen!" & vbNewLine & _ Public MSG_RIGHTMODULE_DE = "Achtung: " & vbNewLine & "Sie haben Änderungen an Rechte-relevanten Eingaben vorgenommen!" & vbNewLine & _
"Alle Rechte der zu diesem Datensatz gespeicherten Dateien werden nach Speichern serverseitig und im Hintergrund überprüft!" & vbNewLine & _ "Alle Rechte der zu diesem Datensatz gespeicherten Dateien werden nach Speichern serverseitig und im Hintergrund überprüft!" & vbNewLine & _

View File

@@ -386,7 +386,7 @@ Public Class frmConstructor_Main
If ACT_EBENE_STRING Is Nothing Then If ACT_EBENE_STRING Is Nothing Then
Exit Sub Exit Sub
End If End If
Dim XMLPath = Get_DocGRid_Layout_Filename() Dim XMLPath = Get_DocGRid_Layout_Filename()
GridViewDoc_Search.SaveLayoutToXml(XMLPath) GridViewDoc_Search.SaveLayoutToXml(XMLPath)
' Update_Status_Label(True, "Grid Layout Loaded") ' Update_Status_Label(True, "Grid Layout Loaded")
@@ -464,7 +464,7 @@ Public Class frmConstructor_Main
settings.Add(New ClassSetting("SplitViewTopSplitterPosition", SplitContainerTop.SplitterPosition)) settings.Add(New ClassSetting("SplitViewTopSplitterPosition", SplitContainerTop.SplitterPosition))
settings.Add(New ClassSetting("SplitViewMainSplitterPosition", SplitContainer1.SplitterPosition)) settings.Add(New ClassSetting("SplitViewMainSplitterPosition", SplitContainer1.SplitterPosition))
End If End If
layout.Save(settings) layout.Save(settings)
Catch ex As Exception Catch ex As Exception
MsgBox("Error in Save_Splitter_Layout:" & vbNewLine & ex.Message) MsgBox("Error in Save_Splitter_Layout:" & vbNewLine & ex.Message)
@@ -1600,7 +1600,7 @@ Public Class frmConstructor_Main
Catch ex As Exception Catch ex As Exception
MsgBox("Unexpected Error in Load TreeView:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) MsgBox("Unexpected Error in Load TreeView:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try End Try
End Sub End Sub
Sub Create_variable_node() Sub Create_variable_node()
@@ -2038,21 +2038,21 @@ Public Class frmConstructor_Main
End If End If
If RIGHT_CONTROL_CHANGED = True Then 'If RIGHT_CONTROL_CHANGED = True Then
Dim msg = MSG_RIGHTMODULE_DE ' Dim msg = MSG_RIGHTMODULE_DE
If USER_LANGUAGE <> "de-DE" Then ' If USER_LANGUAGE <> "de-DE" Then
msg = MSG_RIGHTMODULE_EN_US ' msg = MSG_RIGHTMODULE_EN_US
End If ' End If
Dim result As MsgBoxResult ' Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ' result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then ' If result = MsgBoxResult.No Then
RIGHT_CONTROL_CHANGED = False ' RIGHT_CONTROL_CHANGED = False
RECORD_CHANGED = False ' RECORD_CHANGED = False
DisableEditMode() ' DisableEditMode()
Show_Selected_Record_Data(SELECTED_RECORD_ID, False) ' Show_Selected_Record_Data(SELECTED_RECORD_ID, False)
Return True ' Return True
End If ' End If
End If 'End If
If TrySave_User() = False Then If TrySave_User() = False Then
@@ -2062,6 +2062,7 @@ Public Class frmConstructor_Main
Else Else
If CtrlCommandUI.IsInsert Then If CtrlCommandUI.IsInsert Then
ActivateAllTabs() ActivateAllTabs()
DisableEditMode()
End If End If
End If End If
@@ -2246,7 +2247,7 @@ Public Class frmConstructor_Main
'End If 'End If
If TrySave_Automatic() = True Then If TrySave_Automatic() = True Then
DisableEditMode() DisableEditMode()
End If End If
End If End If
End Sub End Sub
@@ -5714,7 +5715,7 @@ Public Class frmConstructor_Main
End Try End Try
End If End If
End If End If
End If End If
End Sub End Sub