Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Cursor lost when more than one CWGraph in one form

The problem arises in a form containing two CWGraph controls. Happens that the CrossHairStyle, set to cwCrosshairMajorXMajorY behaves as cwCrosshairMajorY in one of the controls.
Exactly the same ".vbp" project, run from another computer, solves the problem.

The control is initialized as follows:
dim intGraph as integer
for intGraph = 1 to 2
With CWGraph(intGraph)
' Y Axis
With .Axes("YAxis-1")
.AutoScale = True
.Caption = "Pressure - cmH2O"
.Discrete = False
.FormatString = "###"
.Labels.Right = False
.Labels.Left = True
.Log = False
End With
.Caption = vbNullString
.ChartLength = 0
.ChartStyle = cwChartStrip
' Cursor
.Cur
sors.Add
With .Cursors.Item(1)
.CrosshairStyle = cwCrosshairMajorXMajorY
.PointStyle = cwPointDottedEmptyCircle
.SnapMode = cwCSnapNearestPoint
.Enabled = True
.Color = VBRUN.ColorConstants.vbRed
End With
.DefaultPlotPerRow = True
.DefaultxFirst = cg_lngZERO
.DefaultxInc = cg_lngONE
.Font.Name = "Arial"
.Font.Size = 7
.GraphFrameColor = VBRUN.SystemColorConstants.vb3DLight
.GraphFrameStyle = cwGraphFrame3D
.ImmediateUpdates = True
.KeyboardMode = cwKeyboardNone
.PlotAreaColor = VBRUN.SystemColorConstants.vbButtonFace
With .Plots(cm_intEPUGPura)
.FillToBase = False
.LineColor = VBRUN.ColorConstants.vbBlue
.LineToBase = False
.LineWidth = 1
' .MultiPlot = True
End With

.Plots.Add
With .Plots(cm_intEPUGtressUppProfile)
.LineColor = VBRUN.ColorConstants.vbCyan
.LineWidth = 1
.LineToBaseColor = .LineColor
.Line
ToBase = False
.FillToBase = False
.FillColor = .LineColor
' .MultiPlot = True
End With
.TrackMode = cwGTrackDragCursor
End With
0 Kudos
Message 1 of 5
(3,990 Views)
Hello,

This is an interesting occurence. Have you been able to reproduce it? What are the differences in your two systems? I modified your code snippet to remove the variables that depend on other parts of your code. When I run the project, I get two plots with majorXmajorY cursors as you did on your second computer.

Here is the modified code that you can simply drop into the code of a form with two xygraphs on it. The snippet doesn't need any other code with the form.

Private Sub Form_Load()
Dim intGraph As Integer
For intGraph = 1 To 2
With CWGraph(intGraph)
' Y Axis
With .Axes("YAxis-1")
.AutoScale = True
.Caption = "Pressure - cmH2O"
.Discrete = False
.FormatString = "###"
.Labels.Right = False
.Labels.Left = True
.Log = False
End With
.Caption = vbNullString
.ChartLength = 0
.ChartStyle = cwChartStrip
' Cursor
.Cursors.Add
With .Cursors.Item(1)
.CrosshairStyle = cwCrosshairMajorXMajorY
.PointStyle = cwPointDottedEmptyCircle
.SnapMode = cwCSnapNearestPoint
.Enabled = True
.Color = VBRUN.ColorConstants.vbRed
End With
.DefaultPlotPerRow = True
.DefaultxFirst = 0
.DefaultxInc = 1
.Font.Name = "Arial"
.Font.Size = 7
.GraphFrameColor = VBRUN.SystemColorConstants.vb3DLight
.GraphFrameStyle = cwGraphFrame3D
.ImmediateUpdates = True
.KeyboardMode = cwKeyboardNone
.PlotAreaColor = VBRUN.SystemColorConstants.vbButtonFace
With .Plots(1)
.FillToBase = False
.LineColor = VBRUN.ColorConstants.vbBlue
.LineToBase = False
.LineWidth = 1
' .MultiPlot = True
End With


.Plots.Add
With .Plots(2)
.LineColor = VBRUN.ColorConstants.vbCyan
.LineWidth = 1
.LineToBaseColor = .LineColor
.LineToBase = False
.FillToBase = False
.FillColor = .LineColor
' .MultiPlot = True
End With
.TrackMode = cwGTrackDragCursor
End With
Next

End Sub
0 Kudos
Message 2 of 5
(3,990 Views)
Well. Before anything else, thank you for lending your hand to the desperate coder next to the africa border.

I must comment three things:
a) Your code works as expected on my computer.
b) The problem now shows exactly the same in the two computers I've got. (I'd swear It wasn't happening on my laptop!)
c) My guess now is that the control behaviour depends on the data to show in it. I'll let you know the results of the investigation.
0 Kudos
Message 3 of 5
(3,990 Views)
I've downsized the code up to the minimum to show the malfunction. The attached code is contained in just one form with two CWGraph controls, and reads the dataq from two files. Hope this allow to reproduce the malfunction.
0 Kudos
Message 4 of 5
(3,990 Views)
Hi I've just come back from vacation, so sorry for no reply in a while. I will look at your code as soon as I can, but I would actually suggest that you send your question and example in to our e-mail support group (http://www.ni.com/ask).

You have already done a lot of work to isolate the problem, so they will be able to dedicate time to it once you send it in through e-mail.

Regards,
John N
0 Kudos
Message 5 of 5
(3,990 Views)