diff --git a/app/DD-Record-Organiser/frmLevel_Designer.vb b/app/DD-Record-Organiser/frmLevel_Designer.vb index c6f164a..5fcf064 100644 --- a/app/DD-Record-Organiser/frmLevel_Designer.vb +++ b/app/DD-Record-Organiser/frmLevel_Designer.vb @@ -5,6 +5,7 @@ Private Mouse_Moving As Boolean = False Private Mouse_Down As Boolean = False Private Current_Properties As Object = Nothing + Private DesignerCtrlBuilder As ClassControlBuilder Private LastCursor As Point = Nothing #End Region @@ -46,63 +47,63 @@ 'Dim random As Integer = r.Next(8, 100) Select Case type Case "lbl" - CtrlBuilder.AddLabel(0, "lbl" & random, defaultCaption, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, "", True, Parent) + DesignerCtrlBuilder.AddLabel(0, "lbl" & random, defaultCaption, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, "", True, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "txt" - CtrlBuilder.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", True, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "cmb" - CtrlBuilder.AddComboBox(0, "cmb" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, "String", True, False, False, "", "", Parent) + DesignerCtrlBuilder.AddComboBox(0, "cmb" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, "String", True, False, False, "", "", Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "dtp" - CtrlBuilder.AddDateTimePicker(0, "dtp" & random, 0, 0, def_font_family, def_font_size, def_font_style, 0, False, 0, 0, False, False, True, Parent) + DesignerCtrlBuilder.AddDateTimePicker(0, "dtp" & random, 0, 0, def_font_family, def_font_size, def_font_style, 0, False, 0, 0, False, False, True, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "dgv" - CtrlBuilder.AddDataGridView(0, "dgv" & random, 0, 0, 0, 0, True, False, False, "dgv" & random, Parent) + DesignerCtrlBuilder.AddDataGridView(0, "dgv" & random, 0, 0, 0, 0, True, False, False, "dgv" & random, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "chk" - CtrlBuilder.AddCheckBox(0, "chk" & random, defaultCaption, False, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, False, 0, 0, True, False, False, Parent) + DesignerCtrlBuilder.AddCheckBox(0, "chk" & random, defaultCaption, False, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, False, 0, 0, True, False, False, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "rb" - CtrlBuilder.AddRadioButton(0, "rb" & random, defaultCaption, False, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, False, 0, 0, True, False, False, Parent) + DesignerCtrlBuilder.AddRadioButton(0, "rb" & random, defaultCaption, False, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, False, 0, 0, True, False, False, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "pb" - CtrlBuilder.AddPictureBox(0, "pb" & random, 0, 0, 0, 0, True, False, False, Parent) + DesignerCtrlBuilder.AddPictureBox(0, "pb" & random, 0, 0, 0, 0, True, False, False, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "gb" - CtrlBuilder.AddGroupBox(0, "gb" & random, defaultCaption, 0, 0, 0, 0, ColorToInt(SystemColors.Control), def_font_color, def_font_family, def_font_size, def_font_style, True, Parent) + DesignerCtrlBuilder.AddGroupBox(0, "gb" & random, defaultCaption, 0, 0, 0, 0, ColorToInt(SystemColors.Control), def_font_color, def_font_family, def_font_size, def_font_style, True, Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "f_addappointment" - CtrlBuilder.FunctionAddAppointment(0, "f_addappointment" & random, defaultCalendarCaption, 0, 0, 0, 0, True, Parent) + DesignerCtrlBuilder.FunctionAddAppointment(0, "f_addappointment" & random, defaultCalendarCaption, 0, 0, 0, 0, True, Parent) - If ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) = True Then - Dim ControlId = GetControlID_for_Name(CtrlBuilder.CurrentControl.Name, CURRENT_FORM_ID) + If ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) = True Then + Dim ControlId = GetControlID_for_Name(DesignerCtrlBuilder.CurrentControl.Name, CURRENT_FORM_ID) ClassFunctionCommands.InsertFunction(ControlId, "ADDAPPOINTMENT") End If Case "f_addformdata" - CtrlBuilder.FunctionAddFormData(0, "f_addformdata" & random, "Add Form Data", 0, 0, 0, 0, True, Parent) + DesignerCtrlBuilder.FunctionAddFormData(0, "f_addformdata" & random, "Add Form Data", 0, 0, 0, 0, True, Parent) - If ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) = True Then - Dim ControlId = GetControlID_for_Name(CtrlBuilder.CurrentControl.Name, CURRENT_FORM_ID) + If ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) = True Then + Dim ControlId = GetControlID_for_Name(DesignerCtrlBuilder.CurrentControl.Name, CURRENT_FORM_ID) ClassFunctionCommands.InsertFunction(ControlId, "ADDFORMDATA") End If Case "lstbxcheck" - CtrlBuilder.AddCheckedListBox(0, "chlb" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, True, False, False, "", "", Parent) + DesignerCtrlBuilder.AddCheckedListBox(0, "chlb" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, True, False, False, "", "", Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case "lstbx" - CtrlBuilder.AddListBox(0, "lbx" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, True, False, False, "", "", Parent) + DesignerCtrlBuilder.AddListBox(0, "lbx" & random, 0, 0, def_font_family, def_font_color, def_font_size, def_font_style, 0, True, 0, 0, True, False, False, "", "", Parent) ' Aktuelles Control in die Datenbank speichern - ClassControlCommands.InsertControl(CtrlBuilder.CurrentControl) + ClassControlCommands.InsertControl(DesignerCtrlBuilder.CurrentControl) Case Else MsgBox("Event '" & type & "' nicht definiert") End Select @@ -161,20 +162,15 @@ Dim wid As Integer = Me.Width Dim update_sizepnl As String = "UPDATE TBPMO_FORM_VIEW SET HEIGHT = " & pnlDesigner.Height & ",WIDTH = " & wid & " where FORM_ID = " & CURRENT_FORM_ID & " and SCREEN_ID = " & CURRENT_SCREEN_ID ClassDatabase.Execute_non_Query(update_sizepnl) - 'frmTool_ControlProperties.Instance.Close() - 'frmTool_ControlDesigner.Instance.Close() - - Catch ex As Exception - + MsgBox("Error in frmLevel_Designer_FormClosing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub Private Sub frmLevel_Designer_Load(sender As Object, e As EventArgs) Handles Me.Load ClassWindowLocation.LoadFormLocationSize(Me, 1, CURRENT_SCREEN_ID, "frmLevel_Designer") - ' ADDED 18.11 - CtrlBuilder = New ClassControlBuilder(pnlDesigner, + DesignerCtrlBuilder = New ClassControlBuilder(pnlDesigner, AddressOf Control_MouseDown, AddressOf Control_MouseUp, AddressOf Control_MouseMove, @@ -228,12 +224,12 @@ Dim parent As GroupBox = Nothing If (dr.Item("CONTROL_PARENT_ID") <> 0) Then Dim parentname As String = Get_Name_for_ControlID(dr.Item("CONTROL_PARENT_ID"), CURRENT_FORM_ID) - parent = CtrlBuilder.GetControlByName(parentname) + parent = DesignerCtrlBuilder.GetControlByName(parentname) End If Select Case dr.Item("CTRLTYPE_ID") Case 1 ' Label - CtrlBuilder.AddLabel(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddLabel(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CAPTION"), dr.Item("CTRLSCR_X_LOC"), @@ -247,7 +243,7 @@ parent, True) Case 2 ' TextBox - CtrlBuilder.AddTextBox(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddTextBox(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_X_LOC"), dr.Item("CTRLSCR_Y_LOC"), @@ -267,7 +263,7 @@ parent, True) Case 3 ' ComboBox - CtrlBuilder.AddComboBox(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddComboBox(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_X_LOC"), dr.Item("CTRLSCR_Y_LOC"), @@ -288,7 +284,7 @@ parent, True) Case 4 ' DateTimePicker - CtrlBuilder.AddDateTimePicker(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddDateTimePicker(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_X_LOC"), dr.Item("CTRLSCR_Y_LOC"), @@ -305,7 +301,7 @@ parent, True) Case 5 ' GroupBox - CtrlBuilder.AddGroupBox(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddGroupBox(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_CAPTION"), dr.Item("CTRLSCR_X_LOC"), @@ -321,7 +317,7 @@ parent, True) Case 6 ' PictureBox - CtrlBuilder.AddPictureBox(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddPictureBox(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_X_LOC"), dr.Item("CTRLSCR_Y_LOC"), @@ -333,7 +329,7 @@ parent, True) Case 7 ' DataGridView - CtrlBuilder.AddDataGridView(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddDataGridView(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_X_LOC"), dr.Item("CTRLSCR_Y_LOC"), @@ -352,7 +348,7 @@ Else Checked = StrToBool(dr.Item("CONTROL_DEF_VALUE")) End If - CtrlBuilder.AddCheckBox(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddCheckBox(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_CAPTION"), Checked, @@ -372,7 +368,7 @@ parent, True) Case 8 'AddAppointment Button - CtrlBuilder.FunctionAddAppointment(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.FunctionAddAppointment(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_CAPTION"), dr.Item("CTRLSCR_X_LOC"), @@ -383,7 +379,7 @@ parent, True) Case 9 'AddFormData - CtrlBuilder.FunctionAddFormData(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.FunctionAddFormData(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_CAPTION"), dr.Item("CTRLSCR_X_LOC"), @@ -401,7 +397,7 @@ Else Checked = StrToBool(dr.Item("CONTROL_DEF_VALUE")) End If - CtrlBuilder.AddRadioButton(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddRadioButton(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_CAPTION"), Checked, @@ -421,7 +417,7 @@ parent, True) Case 12 'CheckedListBox - CtrlBuilder.AddCheckedListBox(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddCheckedListBox(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_X_LOC"), dr.Item("CTRLSCR_Y_LOC"), @@ -441,7 +437,7 @@ parent, True) Case 13 'ListBox - CtrlBuilder.AddListBox(dr.Item("CONTROL_ID"), + DesignerCtrlBuilder.AddListBox(dr.Item("CONTROL_ID"), dr.Item("CONTROL_NAME"), dr.Item("CTRLSCR_X_LOC"), dr.Item("CTRLSCR_Y_LOC"), @@ -473,10 +469,10 @@ ' Aktuelles Control highlighten control.BringToFront() - CtrlBuilder.SetAllActiveColor() + DesignerCtrlBuilder.SetAllActiveColor() ' GUID des aktuellen Controls speichern - CURRENT_CONTROL_ID = ClassControlCommands.GetControlGuid(CtrlBuilder.CurrentControl.Name) + CURRENT_CONTROL_ID = ClassControlCommands.GetControlGuid(DesignerCtrlBuilder.CurrentControl.Name) ' Control Eigenschaften laden 'frmTool_ControlProperties.Instance.pgControlProperties.Enabled = True @@ -484,15 +480,15 @@ 'frmTool_ControlProperties.Instance.LoadControlProperties(CtrlBuilder.CurrentControl) 'frmTool_ControlProperties.Instance.LoadControlPropertiesNeu(CtrlBuilder.CurrentControl) - LoadControlPropertiesNeu(CtrlBuilder.CurrentControl) + LoadControlPropertiesNeu(DesignerCtrlBuilder.CurrentControl) End Sub Private Sub Control_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ' Check to see if the correct button has been pressed If e.Button = Windows.Forms.MouseButtons.Left Then - CtrlBuilder.CurrentControl = sender - CtrlBuilder.BeginLocation = e.Location + DesignerCtrlBuilder.CurrentControl = sender + DesignerCtrlBuilder.BeginLocation = e.Location ' Set the mode flag to signal the MouseMove event handler that it ' needs to now calculate new positions for our control @@ -542,13 +538,13 @@ If Mouse_Moving = True Then Mouse_Moving = False 'end_location = e.Location - CtrlBuilder.EndLocation = e.Location + DesignerCtrlBuilder.EndLocation = e.Location 'frmTool_ControlProperties.Instance.UpdateControlLocation(CtrlBuilder.CurrentControl) - UpdateControlLocation(CtrlBuilder.CurrentControl) - ClassControlCommands.UpdateControlPosition(CtrlBuilder.CurrentControl.Location.X, - CtrlBuilder.CurrentControl.Location.Y, - CtrlBuilder.CurrentControl) + UpdateControlLocation(DesignerCtrlBuilder.CurrentControl) + ClassControlCommands.UpdateControlPosition(DesignerCtrlBuilder.CurrentControl.Location.X, + DesignerCtrlBuilder.CurrentControl.Location.Y, + DesignerCtrlBuilder.CurrentControl) TabControl1.SelectTab("pageProperties") 'Save_Control() @@ -559,7 +555,7 @@ End Sub Private Sub Control_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove Try - If CtrlBuilder.CurrentControl Is Nothing Then + If DesignerCtrlBuilder.CurrentControl Is Nothing Then Exit Sub End If @@ -568,7 +564,7 @@ Me.Refresh() Dim control As Control = DirectCast(sender, Control) - Dim NowCursor As Point = CtrlBuilder.GetCursorPosition() + Dim NowCursor As Point = DesignerCtrlBuilder.GetCursorPosition() ' Wenn das Control in einer GroupBox steckt If ParentIsGroupBox(control) Then @@ -593,8 +589,8 @@ Else ' Alle normalen Controls - control.Location = New Point(NowCursor.X - CtrlBuilder.BeginLocation.X, - NowCursor.Y - CtrlBuilder.BeginLocation.Y) + control.Location = New Point(NowCursor.X - DesignerCtrlBuilder.BeginLocation.X, + NowCursor.Y - DesignerCtrlBuilder.BeginLocation.Y) End If End If Catch ex As Exception @@ -931,7 +927,7 @@ End Function Private Sub btnSaveControl_Click(sender As Object, e As EventArgs) Handles btnSaveControl.Click - If SaveControlProperties(CtrlBuilder.CurrentControl, pgControlProperties.SelectedObject) Then + If SaveControlProperties(DesignerCtrlBuilder.CurrentControl, pgControlProperties.SelectedObject) Then lblStatus.Text = "Änderungen gespeichert - " & Now lblStatus.Visible = True Else @@ -941,8 +937,8 @@ Private Sub btnDeleteControl_Click(sender As Object, e As EventArgs) Handles btnDeleteControl.Click If MsgBox("Wollen Sie das Element wirklich löschen?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - If IsGroupBox(CtrlBuilder.CurrentControl) Then - Dim parentID As Integer = GetControlID_for_Name(CtrlBuilder.CurrentControl.Name, CURRENT_FORM_ID) + If IsGroupBox(DesignerCtrlBuilder.CurrentControl) Then + Dim parentID As Integer = GetControlID_for_Name(DesignerCtrlBuilder.CurrentControl.Name, CURRENT_FORM_ID) Dim SQL = "SELECT GUID FROM TBPMO_CONTROL WHERE PARENT_CONTROL_ID = " & parentID Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL) @@ -955,7 +951,7 @@ If ClassControlCommands.DeleteControl(CURRENT_CONTROL_ID) = True Then 'MsgBox("Element gelöscht, Elemente werden neu geladen.", MsgBoxStyle.Information) - CtrlBuilder.ClearControls() + DesignerCtrlBuilder.ClearControls() frmLevel_Designer.Instance.LoadControls() End If End If @@ -966,7 +962,7 @@ Dim oldValue As Object = e.OldValue Dim newValue As Object = e.ChangedItem.Value Dim currentProperty As String = e.ChangedItem.Label - Dim ctrl As Control = CtrlBuilder.CurrentControl + Dim ctrl As Control = DesignerCtrlBuilder.CurrentControl Select Case currentProperty Case "Location" @@ -998,7 +994,7 @@ 'lblStatus.Text = "Ausstehende Änderungen" 'lblStatus.Visible = True - If SaveControlProperties(CtrlBuilder.CurrentControl, pgControlProperties.SelectedObject) Then + If SaveControlProperties(DesignerCtrlBuilder.CurrentControl, pgControlProperties.SelectedObject) Then If USER_LANGUAGE <> "de-DE" Then lblStatus.Text = "Changes saved - " & Now Else