Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

CW3DGraph in Delphi

I have this simple code (delphi):
 
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  OleCtrls, CW3DGraphLib_TLB, StdCtrls, Math, GeneralDAQEventLib_TLB;
type
  TForm1 = class(TForm)
    CWGraph3D1: TCWGraph3D;
    Button1: TButton;
    Button2: TButton;
    GeneralDAQEvent1: TGeneralDAQEvent;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
 
procedure TForm1.Button2Click(Sender: TObject);
var
i,j:integer;
data:array[0..20,0..20] of Duoble;
begin
  For i:= 0 To 20 do
        For j:= 0 To 20 do
            data[i, j]:= Sin(i * 0.314);
 
    CWGraph3D1.Plot3DSimpleSurface(data);
    CWGraph3D1.Plots(1).Style := cwSurface;
    CWGraph3D1.Plots(1).ColorMapStyle := cwShaded;
end;
end.
When I compiler I get this message:
"[Error] Unit1.pas(60): There is no overloaded version of 'Plot3DSimpleSurface' that can be called with these arguments"
 
 
What happen????

ZGut


0 Kudos
Message 1 of 3
(7,024 Views)
Hey ZGut,
 
We at National Instruments don't really support our Component Works ActiveX controls in Delphi, and they have not been tested.  I will, however, point out one thing that might be a problem just looking at the code.
 
It seems that there is no prototype for the Plot3DSimpleSurface function defined with the specified parameter types.  In Visual C++, the prototype for this function has one parameter that is defined as a CNiMatrix, which is a custom data type that we define in C++.  The translation for a CNiMatrix probably at a lower level is simply a 2-D array of doubles, as it appears you assumed.  The problem that I notice, however, with your code is that you have a 2-D array of Duoble defined rather than double, which may cause a problem.  I'm not sure how Delphi data types are defined, but looks like it would be a different kind of data type.
 
Beyond this advice, maybe one of our users has some advice for using our ActiveX controls in Delphi.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 2 of 3
(7,010 Views)

HI

I am solving this problem.

procedure TForm1.Button2Click(Sender: TObject);
var
i,j:integer;
data:array of Variant;
begin
data:=VarArrayCreate([0,20,0,20],varVariant);
 
  For i:= 0 To 20 do
        For j:= 0 To 20 do
            data[i, j]:= Sin(i * 0.314);
 
    CWGraph3D1.Plot3DSimpleSurface(data);
    CWGraph3D1.Plots(1).Style := cwSurface;
    CWGraph3D1.Plots(1).ColorMapStyle := cwShaded;
end;
end.
Now, it works.
 
Regards
zgut
0 Kudos
Message 3 of 3
(7,000 Views)