Visit Gigasoft's Web Site
ProEssentials v8 Help

Chapter 3: ActiveX using PEvset

The following discusses using PEvset to pass blocks of data quickly within VB6. Within the demo, see example 018 or 123, there are many more that use this feature.

 

1. You need to load the module "PE8API.BAS" or copy the declarations from this file and place into an existing module of your project.

 

2. Use ReDim to dynamically allocate memory to use as a temporary buffer.

 

 ReDim MyTmpData(Pego1.Subsets * Pego1.Points) As Single

 

3. Fill this array in the appropriate form defined by SubsetByPoint. By default you will pass all of the first subset's data-points, followed by the second subset's data-points and so on.

 

4. Use the PEvset function to transfer data.

 

Call PEvset(Pego1.hObject, PEP_faYDATA, MyTmpData(0), Subsets * Points)

 

This VB/Access example code shows how to replace the slow YData property array with the fast PEvset DLL call. Also note that if using double precision YDataII and UsingYDataII is TRUE, then TmpData should be dimensioned as Double rather than Single.

 

 

** Make Random Data for Graph Object **

Pego1.Subsets = 4

Pego1.Points = 12

 

** This is the slow way which is included for comparison **

For s = 0 To 3 4 subsets

   For p = 0 To 11 12 points

      Pego1.YData(s, p) = (p + 1) * 5 + Rnd(25)

   Next p

Next s

 

** Pass data via dynamically allocated one dimensional array **

'** This logic stores all of the first subset's data and

'** then the second subsets's data and so on into the TmpData array.

 

ReDim TmpData(Pego1.Subsets * Pego1.Points) As Single 'Note Single

For s = 0 To 3 4 subsets

   For p = 0 To 11 12 points

      Offset = (s * Pego1.Points) + p

      TmpData(Offset) = (p + 1) * 5 + Rnd(25);

   Next p

Next s

 

Call PEvset(Pego1.hObject, PEP_faYDATA, TmpData(0), 48);

 

Installed Examples

The use of PEvset within VB can also be found in the VB example project and demo. Look for example 123, Form3 within the Scientific Graph examples."