ID Number: Q81999
1.00
WINDOWS
buglist1.00
Summary:
The Graph custom control version 1.2 has four array properties:
ColorData, LegendText, PatternData, and SymbolData. The values of
these properties directly affect the sets of data rather than the
individual points in the sets. With the AutoInc property set to True,
assigning a value to these four arrays will increment ThisPoint rather
than ThisSet. This behavior is a potential cause of logic errors in
code.
Microsoft has confirmed this to be a problem with the Graph version
1.2 custom control supplied with Microsoft Professional Toolkit for
Microsoft Visual Basic programming system version 1.0 for Windows. We
are researching this problem and will post new information here as it
becomes available.
More Information:
There are eight array properties in Graph: GraphData, ExtraData,
LabelText, XPosData, ColorData, LegendText, PatternData, and
SymbolData. To access an individual point in these arrays, you
need to set the ThisSet and ThisPoint properties to indicate that
point. If AutoInc is set to True (AutoInc=1), Graph will
automatically set the ThisPoint and ThisSet properties.
AutoInc increments ThisSet and ThisPoint differently, depending on
which property is being accessed. AutoInc will increment both ThisSet
and ThisPoint when adding data to the GraphData property. For all
other array properties (ExtraData, LabelText, XPosData, ColorData,
LegendText, PatternData, and SymbolData), AutoInc will only increment
ThisPoint. The data that you assign to the ExtraData, LabelText, and
XPosData apply to the individual points of a set, so logically AutoInc
should only increment ThisPoint. However, the data that you assign to
the ColorData, LegendText, PatternData, and SymbolData array
properties apply to the separate sets. In these cases, AutoInc should
logically be incrementing the ThisSet property, but in practice it
increments only the ThisPoint property.
Note: AutoInc is incrementing the proper values internally, so the
data assigned to these four array properties is accurate and will
function properly. AutoInc displays its progress by also incrementing
ThisPoint, which is not always the logical choice.
As a workaround to potential logic problems caused by incrementing
ThisPoint, you should occasionally reset the AutoInc incrementing
position by assigning values for ThisSet and ThisPoint in your code.
A second workaround is to set AutoInc to False (AutoInc=0), and
explicitly set ThisSet and ThisPoint before entering a piece of data.
The following example displays how AutoInc increments ThisPoint and
ThisSet when assigning values to ColorData. To test another array
property, substitute that array name for ColorData.
Example
-------
1. With Visual Basic running and the Graph custom control loaded,
create a form (Form1).
2. On Form1, add a command button (Command1), a picture box
(Picture1), and a graph control (Graph1).
3. Change the following properties for Command1:
Control Property Value
------- -------- -----
Command1 Caption "Start"
Graph1 AutoInc 1 (true)
Graph1 NumSets 2
Graph1 NumPoints 3
4. Add the following code to the Command1 Click event:
Sub Command1_Click ()
Command1.Caption = "ColorData" 'set caption equal to array
'property name to be tested
Picture1.Cls
Picture1.Print "ThisSet", "ThisPoint"
' loop through full array:
For i = 1 To Graph1.NumSets * Graph1.NumPoints
Picture1.Print Graph1.ThisSet, Graph1.ThisPoint
Graph1.ColorData = 1 'Make some valid assignment so
' AutoInc increments
Next
Graph1.DrawMode = 2 'display newly assigned values
End Sub
5. Press F5 to run the program.
When you run the program and click on the Command1 button, the program
will display the array property being tested, and the picture box will
display the increment pattern of ThisSet and ThisPoint as the program
loops through the array property. The graph is then updated to display
the newly assigned values.
Additional reference words: 1.00