JJ ReadOnly, fix SQL Editor
This commit is contained in:
@@ -11,14 +11,9 @@ Public Class ClassControlBuilder
|
||||
Private _mouse_click_handler As EventHandler
|
||||
Private _group_box_drag_drop_handler As DragEventHandler
|
||||
Private _tool_tip As ToolTip
|
||||
|
||||
Private binding1 As BindingSource
|
||||
|
||||
Private OnRecordChangedName As String = "OnRecordChanged"
|
||||
Private _onRecordChangedName As String = "OnRecordChanged"
|
||||
Private _events As System.ComponentModel.EventHandlerList = Nothing
|
||||
|
||||
|
||||
|
||||
Protected ReadOnly Property Events() As System.ComponentModel.EventHandlerList
|
||||
Get
|
||||
If _events Is Nothing Then
|
||||
@@ -31,15 +26,15 @@ Public Class ClassControlBuilder
|
||||
' +++ RecordChanged Event +++
|
||||
Public Custom Event OnRecordChanged As EventHandler
|
||||
AddHandler(value As EventHandler)
|
||||
Me.Events.AddHandler(OnRecordChangedName, value)
|
||||
Me.Events.AddHandler(_onRecordChangedName, value)
|
||||
End AddHandler
|
||||
|
||||
RemoveHandler(value As EventHandler)
|
||||
Me.Events.RemoveHandler(OnRecordChangedName, value)
|
||||
Me.Events.RemoveHandler(_onRecordChangedName, value)
|
||||
End RemoveHandler
|
||||
|
||||
RaiseEvent(sender As Object, e As EventArgs)
|
||||
CType(Me.Events(OnRecordChangedName), EventHandler).Invoke(sender, e)
|
||||
CType(Me.Events(_onRecordChangedName), EventHandler).Invoke(sender, e)
|
||||
End RaiseEvent
|
||||
End Event
|
||||
|
||||
@@ -47,7 +42,7 @@ Public Class ClassControlBuilder
|
||||
' Handler für alle Controls
|
||||
' ==================================================================================
|
||||
Public Sub RecordChanged(sender As Object, ByVal e As EventArgs)
|
||||
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(OnRecordChangedName), EventHandler)
|
||||
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
|
||||
|
||||
If (onRecordChangedHandler IsNot Nothing) Then
|
||||
onRecordChangedHandler.Invoke(sender, e)
|
||||
@@ -56,7 +51,7 @@ Public Class ClassControlBuilder
|
||||
|
||||
' CheckedListBox hat andere Handler Signatur
|
||||
Public Sub RecordChanged(sender As Object, ByVal e As DevExpress.XtraEditors.Controls.ItemCheckEventArgs)
|
||||
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(OnRecordChangedName), EventHandler)
|
||||
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
|
||||
|
||||
If (onRecordChangedHandler IsNot Nothing) Then
|
||||
onRecordChangedHandler.Invoke(sender, e)
|
||||
@@ -572,6 +567,7 @@ Public Class ClassControlBuilder
|
||||
control.Multiline = True
|
||||
control.AcceptsReturn = True
|
||||
control.AcceptsTab = True
|
||||
control.ScrollBars = ScrollBars.Vertical
|
||||
End If
|
||||
|
||||
If _new And IsNothing(parent) Then
|
||||
@@ -591,7 +587,9 @@ Public Class ClassControlBuilder
|
||||
control.Cursor = Cursors.Hand
|
||||
End If
|
||||
|
||||
Me.SetEventHandlers(control)
|
||||
If Not read_only Then
|
||||
Me.SetEventHandlers(control)
|
||||
End If
|
||||
|
||||
Me.CurrentControl = DirectCast(control, TextBox)
|
||||
If Not IsNothing(parent) Then
|
||||
@@ -622,7 +620,8 @@ Public Class ClassControlBuilder
|
||||
vwidth As Integer,
|
||||
vheight As Integer,
|
||||
_new As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
read_only As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
Optional _designMode As Boolean = False)
|
||||
Try
|
||||
Dim control As New CheckBox
|
||||
@@ -642,6 +641,10 @@ Public Class ClassControlBuilder
|
||||
control.AutoCheck = True
|
||||
End If
|
||||
|
||||
If Not _designMode And read_only Then
|
||||
control.Enabled = Not read_only
|
||||
End If
|
||||
|
||||
If _new And IsNothing(parent) Then
|
||||
control.Location = Me.GetCursorPosition()
|
||||
control.Size = defaultSize
|
||||
@@ -683,6 +686,7 @@ Public Class ClassControlBuilder
|
||||
vwidth As Integer,
|
||||
vheight As Integer,
|
||||
_new As Boolean,
|
||||
read_only As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
Optional _designMode As Boolean = False)
|
||||
Try
|
||||
@@ -711,6 +715,10 @@ Public Class ClassControlBuilder
|
||||
control.Size = New Size(vwidth, vheight)
|
||||
End If
|
||||
|
||||
If Not _designMode And read_only Then
|
||||
control.Enabled = Not read_only
|
||||
End If
|
||||
|
||||
If _designMode = True Then
|
||||
control.Cursor = Cursors.Hand
|
||||
End If
|
||||
@@ -742,6 +750,7 @@ Public Class ClassControlBuilder
|
||||
vheight As Integer,
|
||||
vformat As String,
|
||||
_new As Boolean,
|
||||
read_only As Boolean,
|
||||
static_list As String,
|
||||
sqlcommand As String,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
@@ -759,6 +768,10 @@ Public Class ClassControlBuilder
|
||||
control.DropDownStyle = ComboBoxStyle.DropDown
|
||||
control.FormattingEnabled = True
|
||||
|
||||
If (Not _designMode And read_only) Then
|
||||
control.Enabled = Not read_only
|
||||
End If
|
||||
|
||||
AddComboHandler(control, vformat)
|
||||
|
||||
If _new And IsNothing(parent) Then
|
||||
@@ -885,6 +898,7 @@ Public Class ClassControlBuilder
|
||||
tabstop As Boolean,
|
||||
vwidth As Integer,
|
||||
vheight As Integer,
|
||||
read_only As Boolean,
|
||||
_new As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
Optional _designMode As Boolean = False)
|
||||
@@ -903,6 +917,7 @@ Public Class ClassControlBuilder
|
||||
control.Parent = _master_panel
|
||||
control.Properties.NullDate = DateTime.MinValue
|
||||
control.Properties.NullText = String.Empty
|
||||
control.Properties.ReadOnly = read_only
|
||||
|
||||
If _new And IsNothing(parent) Then
|
||||
control.Location = Me.GetCursorPosition()
|
||||
@@ -917,7 +932,10 @@ Public Class ClassControlBuilder
|
||||
control.Size = New Size(vwidth, vheight)
|
||||
End If
|
||||
|
||||
Me.SetEventHandlers(control)
|
||||
If Not read_only Then
|
||||
Me.SetEventHandlers(control)
|
||||
End If
|
||||
|
||||
'Me.CurrentControl = DirectCast(control, DateTimePicker)
|
||||
Me.CurrentControl = DirectCast(control, DevExpress.XtraEditors.DateEdit)
|
||||
If Not IsNothing(parent) Then
|
||||
@@ -938,6 +956,7 @@ Public Class ClassControlBuilder
|
||||
vwidth As Integer,
|
||||
vheight As Integer,
|
||||
_new As Boolean,
|
||||
read_only As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
Optional _designMode As Boolean = False)
|
||||
|
||||
@@ -952,6 +971,7 @@ Public Class ClassControlBuilder
|
||||
control.AllowUserToResizeColumns = False
|
||||
control.AllowUserToResizeRows = False
|
||||
control.Parent = _master_panel
|
||||
control.ReadOnly = read_only
|
||||
|
||||
column.HeaderText = ""
|
||||
column.Name = "column1"
|
||||
@@ -990,7 +1010,8 @@ Public Class ClassControlBuilder
|
||||
vwidth As Integer,
|
||||
vheight As Integer,
|
||||
_new As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
read_only As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
Optional _designMode As Boolean = False)
|
||||
|
||||
Dim control As New PictureBox
|
||||
@@ -1009,8 +1030,10 @@ Public Class ClassControlBuilder
|
||||
AddHandler itemDel.Click, AddressOf itemDel_Click
|
||||
AddHandler itemSave.Click, AddressOf itemSave_Click
|
||||
|
||||
ctx.Items.Add(itemAdd)
|
||||
ctx.Items.Add(itemDel)
|
||||
If read_only Then
|
||||
ctx.Items.Add(itemAdd)
|
||||
ctx.Items.Add(itemDel)
|
||||
End If
|
||||
ctx.Items.Add(itemSave)
|
||||
|
||||
control.Name = name
|
||||
@@ -1059,7 +1082,7 @@ Public Class ClassControlBuilder
|
||||
fontsize As Integer,
|
||||
fontstyle As Integer,
|
||||
_new As Boolean,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
Optional _designMode As Boolean = False)
|
||||
|
||||
Dim control As New GroupBox
|
||||
@@ -1220,6 +1243,7 @@ Public Class ClassControlBuilder
|
||||
vwidth As Integer,
|
||||
vheight As Integer,
|
||||
_new As Boolean,
|
||||
read_only As Boolean,
|
||||
static_list As String,
|
||||
sqlcommand As String,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
@@ -1237,6 +1261,10 @@ Public Class ClassControlBuilder
|
||||
control.TabStop = tabstop
|
||||
control.Parent = _master_panel
|
||||
|
||||
If Not _designMode And read_only Then
|
||||
control.Enabled = Not read_only
|
||||
End If
|
||||
|
||||
Dim ctx As New ContextMenuStrip()
|
||||
|
||||
Dim selectAll As New ToolStripMenuItem()
|
||||
@@ -1315,6 +1343,7 @@ Public Class ClassControlBuilder
|
||||
vwidth As Integer,
|
||||
vheight As Integer,
|
||||
_new As Boolean,
|
||||
read_only As Boolean,
|
||||
static_list As String,
|
||||
sqlcommand As String,
|
||||
Optional parent As GroupBox = Nothing,
|
||||
@@ -1332,6 +1361,10 @@ Public Class ClassControlBuilder
|
||||
control.TabStop = tabstop
|
||||
control.Parent = _master_panel
|
||||
|
||||
If Not _designMode And read_only Then
|
||||
control.Enabled = Not read_only
|
||||
End If
|
||||
|
||||
If _new And IsNothing(parent) Then
|
||||
control.Location = Me.GetCursorPosition()
|
||||
control.Size = defaultSize
|
||||
|
||||
Reference in New Issue
Block a user