Jose,
I have a TypeLib (Grapher from www.GoldenSoftware.com), when I load the TypeLibrary I can get the Code to display, but don't get any Events. Is this normal?
Any assistance would be appreciated.
Regards
Andrew
If it has events, you will get them clicking the "Events" toolbar button (it will be disabled if there aren't event interfaces).
OK,
I have my little mind around that one, it is a graphing/charting package and doesn't need to be able to interact with the user.
Now I am trying to interact with the control using the following VB6 code as an example (PS - if it makes any difference, I am using FF3.04).
' Dimension a Grapher object
Dim GraphObj As Object
' Create a new Grapher object instance
Set GraphObj = CreateObject("Grapher.Application")
' Make Grapher visible
GraphObj.Visible (1)
' Create a new Grapher document
Set doc1 = GraphObj.Documents.Add()
' Set the fill properties for the document to empty
doc1.SetFillProperties , , "None"
' Create a line plot
' Note: you will need to modify the path and directory of the
' sample data file. This file will be located in your
' Samples subdirectory under Grapher.
doc1.CreateLinePlot "Graph 1", "Line Plot 1", "f:\gs\test files\sample4.dat"
' Change the line properties of the graph
doc1.SetObjectLineProps "Graph 1:Line Plot 1", "Red", ".3 in. Dash"
' Create a legend
doc1.CreateLegend "Graph 1", "L2", 4, 8, , , , 0
' Add a new legend entry
doc1.AddLegendEntry "Graph 1:L2", "Graph 1:Line Plot 1", , , , , , 1, 0.5
' Change the fill properties to a red/blue/crosshatch pattern
doc1.SetFillProperties "Red", "Blue", "Crosshatch", 1
' Draw a rectangle with the newly defined
' fill colors and style
doc1.DrawRectangle 1, 10, 4, 9
' Make the plot view to the window
doc1.ViewFitToWindow
I can get the interface using
Local pGraphDispatch As IGraph
Local doc1 As IGraph
Local vTmp As Variant
pGraphDispatch = OC_GetDispatch(HWND_GRAPH_OCXCONTROL1)
If IsObject(pGraphDispatch) Then.
But now I am not sure what to do.
I have tried
' Make Grapher visible
vTmp = 1
Let pGraphDispatch.Visible = vTmp
But this does not work, I get the following error...
"Error 415 "=" Expected".
Any assistance would be appreciated.
Regards
Andrew
To be able to help you I will need the code for the interface definitions.
Here is the INC file created by your browser.
I Have also included the PB Generated INC file as well.
Regards
Andrew
The typical ActiveX control made for VB that are a pain to use with other languages. The translation will be something like this:
' Dimension a Grapher object
'Dim GraphObj As Object
DIM GraphObj AS DISPATCH
DIM doc1 AS DISPATCH
DIM vOpt AS VARIANT
DIM vPrm1 AS VARIANT
DIM vPrm2 AS VARIANT
DIM vPrm3 AS VARIANT
DIM vPrm4 AS VARIANT
DIM vPrm5 AS VARIANT
vOpt = ERROR %DISP_E_PARAMNOTFOUND
' Create a new Grapher object instance
'Set GraphObj = CreateObject("Grapher.Application")
GraphObj = OC_GetDispatch(HWND_GRAPH_OCXCONTROL1)
IF ISOBJECT(GRaphObj) THEN
' Make Grapher visible
'GraphObj.Visible (1)
vPrm = 1 AS INTEGER
OBJECT LET GraphObj.Visible = vPrm
' Create a new Grapher document
'Set doc1 = GraphObj.Documents.Add()
OBJECT CALL GraphObj.Documents.Add() TO doc1
' Set the fill properties for the document to empty
'doc1.SetFillProperties , , "None"
vPrm = "None"
OBJECT CALL doc1.SetFillProperties(vOpt, vOpt, vPrm)
' Create a line plot
' Note: you will need to modify the path and directory of the
' sample data file. This file will be located in your
' Samples subdirectory under Grapher.
vPrm1 = "Graph 1"
vPrm2 = "Line Plot 1"
vPrm3 = "f:\gs\test files\sample4.dat"
'doc1.CreateLinePlot "Graph 1", "Line Plot 1", "f:\gs\test files\sample4.dat"
OBJECT CALL doc1.CreateLinePlot(vPrm1, vPrm2, vPrm3)
' Change the line properties of the graph
vPrm1 = "Graph 1:Line Plot 1"
vPrm2 = "Red"
vPrm3 = ".3 in. Dash"
doc1.SetObjectLineProps "Graph 1:Line Plot 1", "Red", ".3 in. Dash"
OBJECT CALL doc1.SetObjectLineProps(vPrm1, vPrm2, vPrm3)
' Create a legend
vPrm1 = "Graph 1"
vPrm2 = "L2"
vPrm3 = 4
vPrm4 = 8
vPrm5 = 0
'doc1.CreateLegend "Graph 1", "L2", 4, 8, , , , 0
OBJECT CALL doc1.CreateLegend(vPrm1, vPrm2, vPrm3, vPrm4, vOpt, vOpt, vOpt, vPrm5)
' Add a new legend entry
vPrm1 = "Graph 1:L2"
vPrm2 = "Graph 1:Line Plot 1"
vPrm3 = 1
vPrm4 = 0.5
'doc1.AddLegendEntry "Graph 1:L2", "Graph 1:Line Plot 1", , , , , , 1, 0.5
OBJECT CALL doc1.AddLegendEntry(vPrm1, vPrm2, vOpt, vOpt, vOpt, vOpt, v>opt, vPrm3, vPrm4)
' Change the fill properties to a red/blue/crosshatch pattern
vPrm1 = "Red"
vPrm2 = "Blue"
vPrm3 = "Crosshatch"
vPrm4 = 1
'doc1.SetFillProperties "Red", "Blue", "Crosshatch", 1
OBJECT CALL doc1.SetFillProperties(vPrm1, vPrm2, vPrm3, vPrm4)
' Draw a rectangle with the newly defined
' fill colors and style
vPrm1 = 1
vPrm2 = 10
vPrm3 = 4
vPrm4 = 9
'doc1.DrawRectangle 1, 10, 4, 9
OBJECT CALL doc1.DrawRectangle(vPrm1, vPrm2, vPrm3, vPrm4)
' Make the plot view to the window
'doc1.ViewFitToWindow
OBJECT CALL doc1.ViewFitToWindow
END IF
Jose,
Thanks for that assistance. I have corrected a few of the typos and got it to compile and run.
Best regards
Andrew