• Welcome to Theos PowerBasic Museum 2017.

Problems with OCX Control

Started by Carlos M Restrepo, October 27, 2010, 04:34:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Carlos M Restrepo

I'm trying to make a line graph using FireFly 3 Visual Designer for Windows Ver 3.0,  and compiler PowerBasic 9, but I get the error 480: Parameter mismatches definition when I use AddLineSeries property.

The procedure used is as follows:

- From FireFly workspace tools tab select and create the control OCX / ActiveX.


- From Properties Tab select OCX_ProgID and open TypeLib Browser 4.0.13 by Jose Roca

- Select Simple Chart ToolKit 2.1 (Ver 1.0) SIMPLECHART4.DLL

-Select tab TypeInfo
-Expand  ProgIds
-Select SimpleChart.AxisChart.4

-Back to FF, and in the OCX_ProgID property textbox enter SimpleChar.AxisChart.4

-Create new code module and paste all the cod generated in TypeLib Browser

- In the WM_CREATE message handle of the form write the code:

   Local pAxChartDispatch as IAxisChart
   if IsObject (pAxChartDispatch) then
      .
      ...some basic code
      .
      pAxchartDispatch.DataSeries.AddLineSeries "Target", %RGB_RED, 3, %scLineStyleSolid
      .
   end if


This is the point where the error 480 occurs.
What am I doing wrong?
What can I do to correct this error?



Dominic Mitchell

The optional parameters for this method are variants. Unfortunately, PowerBASIC does not
seem to accept literal values for this type of parameter.  Therefore, use a variant variable
to pass the optional values.

Form example, if you were doing a bar chart, you will do this

    vFillMode = %FILLSTYLE_SCFILLMODEAUTOSOLID
    oAxisChart.DataSeries.AddBarSeries(UCODE$("2000"), vFillMode)

    oAxisChart.DataSeries.Item(1).SeriesData.Add(UCODE$("Q1"), 600)
    oAxisChart.DataSeries.Item(1).SeriesData.Add(UCODE$("Q2"), 745)
    oAxisChart.DataSeries.Item(1).SeriesData.Add(UCODE$("Q3"), 832)
    oAxisChart.DataSeries.Item(1).SeriesData.Add(UCODE$("Q4"), 415)
                     

Also, note the use of Ucode$. Strings in COM are Unicode not ANSI.   

The compound syntax can get tedious after a while. You might want to do this(bar chart again)

    oDataSeries = oAxisChart.DataSeries   
    vFillMode = %FILLSTYLE_SCFILLMODEAUTOSOLID
    oDataSeries.AddBarSeries(UCODE$("2000"), vFillMode)
    oBarSeries = oDataSeries.Item(1).SeriesData

    oBarSeries.Add(UCODE$("Q1"), 600)
    oBarSeries.Add(UCODE$("Q2"), 745)
    oBarSeries.Add(UCODE$("Q3"), 832)
    oBarSeries.Add(UCODE$("Q4"), 415)
Dominic Mitchell
Phoenix Visual Designer
http://www.phnxthunder.com

Carlos M Restrepo

Dominic, Thanks for your help. Your solution works fine.