@@Display Only wie ReadOnly behandeln Try1

This commit is contained in:
Developer01 2025-08-19 13:34:55 +02:00
parent f21dbd3423
commit a9cc02c4b4

View File

@ -110,17 +110,22 @@ Public Class ClassControlCreator
Dim family As FontFamily = New FontFamily(familyString) Dim family As FontFamily = New FontFamily(familyString)
Dim oGuid As Integer = row.Item("GUID") Dim oGuid As Integer = row.Item("GUID")
Dim oName As String = NotNull(row.Item("NAME"), "") Dim oControlName As String = NotNull(row.Item("NAME"), "")
Dim oAttribute As String = NotNull(row.Item("INDEX_NAME"), "") Dim oAttribute As String = NotNull(row.Item("INDEX_NAME"), "")
Dim oLocation As New Point(x, y) Dim oLocation As New Point(x, y)
Dim oFont As New Font(family, size, style, GraphicsUnit.Point) Dim oFont As New Font(family, size, style, GraphicsUnit.Point)
Dim oColor As Color = IntToColor(NotNull(row.Item("FONT_COLOR"), DEFAULT_COLOR)) Dim oColor As Color = IntToColor(NotNull(row.Item("FONT_COLOR"), DEFAULT_COLOR))
Dim oReadOnly As Boolean = row.Item("READ_ONLY") Dim oReadOnly As Boolean = row.Item("READ_ONLY")
Dim oAddNewItems As Boolean = row.Item("VKT_ADD_ITEM") Dim oAddNewItems As Boolean = row.Item("VKT_ADD_ITEM")
If oAttribute = "@@DISPLAY_ONLY" And oReadOnly = False Then
Logger.Info($"Override oReadOnly = True for Control [{oControlName}] as Attribute is @@DISPLAY_ONLY and ReadOnly = False")
oReadOnly = True
End If
Return New ControlDBProps() With { Return New ControlDBProps() With {
.Guid = oGuid, .Guid = oGuid,
.Name = oName, .Name = oControlName,
.Attribute = oAttribute, .Attribute = oAttribute,
.Location = oLocation, .Location = oLocation,
.Font = oFont, .Font = oFont,
@ -305,9 +310,8 @@ Public Class ClassControlCreator
Dim oReadOnly = oControlRow.ItemEx("READ_ONLY", False) Dim oReadOnly = oControlRow.ItemEx("READ_ONLY", False)
Dim oFormatString = oControlRow.ItemEx("FORMAT_STRING", String.Empty) Dim oFormatString = oControlRow.ItemEx("FORMAT_STRING", String.Empty)
Dim oBackColorIf = oControlRow.ItemEx("CTRL_BACKCOLOR_IF", String.Empty) Dim oBackColorIf = oControlRow.ItemEx("CTRL_BACKCOLOR_IF", String.Empty)
Dim oIndexname = oControlRow.ItemEx("INDEX_NAME", String.Empty)
Dim oControl As BaseEdit = Nothing Dim oControl As BaseEdit = Nothing
If oHeight >= 27 Then If oHeight >= 27 Then
oControl = CreateBaseControl(New MemoEdit(), oControlRow, designMode) oControl = CreateBaseControl(New MemoEdit(), oControlRow, designMode)
Else Else
@ -323,19 +327,19 @@ Public Class ClassControlCreator
oControl.Width = oWidth oControl.Width = oWidth
If Not designMode Then If Not designMode Then
oControl.ReadOnly = oReadOnly 'oControl.ReadOnly = oReadOnly
oControl.TabStop = Not oReadOnly oControl.TabStop = Not oReadOnly
oControl.BackColor = IIf(oReadOnly, Color.LightGray, Color.White) oControl.BackColor = IIf(oReadOnly, Color.LightGray, Color.White)
' If there is a format string defined, set it for display only. ' If there is a format string defined, set it for display only.
' Editing will be without format string, according to current user-culture. ' Editing will be without format string, according to current user-culture.
If oFormatString <> String.Empty And oReadOnly = False Then If oFormatString <> String.Empty Then
oControl.Properties.DisplayFormat.FormatType = FormatType.Custom oControl.Properties.DisplayFormat.FormatType = FormatType.Custom
oControl.Properties.DisplayFormat.FormatString = ClassFormat.GetFormatString(oFormatString) oControl.Properties.DisplayFormat.FormatString = ClassFormat.GetFormatString(oFormatString)
ElseIf oReadOnly Then 'ElseIf oReadOnly Then
' For read only controls, don't show the raw value when a user clicks into it ' ' For read only controls, don't show the raw value when a user clicks into it
oControl.Properties.EditFormat.FormatType = FormatType.Custom ' oControl.Properties.EditFormat.FormatType = FormatType.Custom
oControl.Properties.EditFormat.FormatString = ClassFormat.GetFormatString(oFormatString) ' oControl.Properties.EditFormat.FormatString = ClassFormat.GetFormatString(oFormatString)
End If End If
Else Else
oControl.ReadOnly = True oControl.ReadOnly = True