投稿

GEA控件更新记录

kittenchen intouch
2023-07-10 0 22

20230710

在SENSOR页面,点击指定的坐标轴,下面的序列和实际轴的序列不一样

ggrValueX = TChart1.Series(SeriesIndex).XValues.value(ValueIndex) + 1


加个1

因为teechart是从0开始的


20230509

image

反馈说曲线界面不自动刷新,看代码没什么问题

最后查到在控件里判断grVisible值的判断,实际传递的是1,但判断是用true,直接改一下了

在自动刷新函数里改了

ElseIf grVisible = True Or grVisible = 1 Then
    Dim iii
    For iii = 0 To TChart1.SeriesCount - 1
    With TChart1.Series(iii)
        .DataSource = rs
        .CheckDataSource
        .RefreshSeries
    End With
    Next
    
    If Limitsaction = 1 Then
    Call changecolor
    End If
    

End If

2022.10.10

问题:在实时报警界面,报警消除后颜色没有及时变色

处理:开始以为是自动刷新时间的问题,最后发现其实是自动刷新判断是否有使用grid的true判断上出问题了,1和true。顺便把判断rs是否为空也改了一下

Private Sub timAutoRefresh_Timer()
On Error Resume Next

If Cnn.State = 1 Then
gConnectionStatus = True
Else
MsgBox "SQL Connect Error"
Exit Sub
End If
Set rs = New ADODB.Recordset
rs.CursorType = CursorType
rs.CursorLocation = CursorLocation
'Set rs = Cnn.execute(gSQLstatement)
rs.Open gSQLstatement, Cnn, 1, 1

If (rs.BOF And rs.EOF) Then Exit Sub


If dgVisible = True Then
    Set VSFlexGrid1.DataSource = rs
    If VSFlexGrid1.Rows < 2 Then VSFlexGrid1.Rows = 2
    If dgAllowColorHighlighting > 0 Then
     If StringHighlightRule.Count > 0 Then
     
        Dim i, ii
    
        For i = 1 To StringHighlightRule.Count
            For ii = 1 To VSFlexGrid1.Rows - 1
                Dim findcol, text, Color, testtext
                findcol = StringHighlightRule.Item(i).Item(1)
                text = StringHighlightRule.Item(i).Item(2)
                Color = StringHighlightRule.Item(i).Item(3)
                testtext = VSFlexGrid1.TextMatrix(ii, findcol)
                If VSFlexGrid1.TextMatrix(ii, findcol) = text Then
                'MsgBox (StringHighlightRule.Item(i).Item(0))
                Call Setrowcolor(ii, Color)
                'MSHFlexGrid1.CellForeColor = &HFF&      'StringHighlightRule.Item(i).Item(2)
                End If
            
            
            Next
        Next
     
     End If
     gdgNumberOfRows = VSFlexGrid1.Rows
    End If
ElseIf grVisible = True Then
    Dim iii
    For iii = 0 To TChart1.SeriesCount - 1
    With TChart1.Series(iii)
        .DataSource = rs
        .CheckDataSource
        .RefreshSeries
    End With
    Next
    If Limitsaction = 1 Then
    Call changecolor
    End If
End If
End Sub

2022.09.30

问题:在SETUP的界面,时有报警窗口弹出,初步判断是381 array index之类的下标越界

去控件内代码作一些判断和修改,如果空或负无效值时的处理

Public Function dgSetCellFontColor(Color As Variant, Optional row1 As Variant, Optional col1 As Variant, Optional row2 As Variant, Optional col2 As Variant)
On Error Resume Next
If Not IsMissing(row1) And Not IsMissing(row2) And Not IsMissing(col1) And Not IsMissing(col2) Then
    If row1 >= 0 And row2 >= 0 And col1 >= 0 And col2 >= 0 And VSFlexGrid1.Rows >= row2 And VSFlexGrid1.Rows >= row1 And VSFlexGrid1.Cols >= col1 And VSFlexGrid1.Cols >= col2 Then VSFlexGrid1.Cell(flexcpForeColor, row1, col1, row2, col2) = Color
End If
End Function

2022.09.22

最后在更新时琮是作了判断再处理,中文查询的时候INTOUCH发给控件估计字节长度问题,多了一个char(0)

作了如下处理

Public Function AppendStatement(ByVal QY As Variant)
On Error Resume Next

If (InStr(1, QY, "'") And InStr(1, QY, Chr(0))) Then
QY = Trim(QY)
QY = Replace(QY, Chr(0), "")
Dim Y() As String
Y = Split(QY, "'")
QY = Y(0) & "'" & Y(1) & "'"
End If
'MsgBox QY
'MsgBox Len(QY)
'


gSQLstatement = gSQLstatement & " " & QY

'MsgBox gSQLstatement



End Function

2022.09.21

在配方加载页面,选中文没有显示列表,SQL的拼接没有加空格,导致语句搞一起了

Public Function AppendStatement(QY As String)
On Error Resume Next
gSQLstatement = gSQLstatement + " " + QY

End Function

2022-09-16

问题点,当没有数据的时候,只显示了列标题,不好看

那就加一个,如果没有数据就显示个空行

就在绑定数据源后加个判断,如果小于2行,那就让它是两行

Set VSFlexGrid1.DataSource = rs

If VSFlexGrid1.Rows < 2 Then VSFlexGrid1.Rows = 2

原效果

image

修改后的效果

image



文章为作者原创,不要转载哦!

首页 编程信息 intouch GEA控件更新记录

相关文章