How can I solve this ? The Vegas class has no public constructor
#using ScriptPortal.Vegas
FUNCTION Start( ) AS VOID
LOCAL oVegas AS Vegas
oVegas:=Vegas{}
error XS1729: 'Vegas' does not contain a constructor that takes 0 arguments
Vegas is a class part of the video-edting software Sony Vegas,
Calling a class that has no public constructor
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Calling a class that has no public constructor
The message says it does not have a constructor which takes zero arguments - BUT - the does not mean that it has no constructor.
Try supplying one or more nulls !?
Just a thought off the top of my head.
Cheers,
Phil.
Try supplying one or more nulls !?
Just a thought off the top of my head.
Cheers,
Phil.
Calling a class that has no public constructor
JP,
What Phil said, or there is a static method in the class or a static property that allows you to create/access instances.
Robert
What Phil said, or there is a static method in the class or a static property that allows you to create/access instances.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Calling a class that has no public constructor
When I right click on the Vegas{} to see the parameters, it says it has no public constructor.
Of course I tried with 1...4 null parameters, the resulting error is : it has no constructor with 1..4 parameters.
Of course I tried with 1...4 null parameters, the resulting error is : it has no constructor with 1..4 parameters.
Calling a class that has no public constructor
I tried to do this simple test
cTest:=Vegas:Version
the Xide interface shows all methods and accesses of Vegas when I type the :
This however gives another compiler error :
error XS0120: An object reference is required for the non-static field, method, or property 'Vegas.Version'
cTest:=Vegas:Version
the Xide interface shows all methods and accesses of Vegas when I type the :
This however gives another compiler error :
error XS0120: An object reference is required for the non-static field, method, or property 'Vegas.Version'
Calling a class that has no public constructor
Jean-Pierre,
you have to type:
cTest := Vegas.Version to access a Static-Class member
you have to type:
cTest := Vegas.Version to access a Static-Class member
Calling a class that has no public constructor
Hi Jean-Pierre,
that's the kind of scenario where you don't need to call the constructor, either :
. because you must use a static Method that will always return the same Vegas object that is created internally, so you have a Singleton
. because you will receive the Vegas object when your code is called by the application that will consume your extension (Here that's my favorite option)
Hope this helps.
Cheers,
Fabrice
that's the kind of scenario where you don't need to call the constructor, either :
. because you must use a static Method that will always return the same Vegas object that is created internally, so you have a Singleton
. because you will receive the Vegas object when your code is called by the application that will consume your extension (Here that's my favorite option)
Hope this helps.
Cheers,
Fabrice
XSharp Development Team
fabrice(at)xsharp.eu
fabrice(at)xsharp.eu
Calling a class that has no public constructor
Hi Jean-Pierre,
It is a bug of XIDE that it shows members on "Vegas:", ":" is used on instances of types only, is not valid on types themselves, so this should show nothing. But try a dot instead, to see the static members of the class, with "Vegas.", does the list now contain an entry like "Create", "CreateInstance" or something like that?
In any case, as others already pointed out, the fact that there does not exist a public constructor means that the developer of the class did not intend (and does not allow) to let the programmer create an instance of this class directly. Instead they must have provided another means of getting such an instance, but it's too hard to say how, without some documentation or without looking at the full contents of the dll in a disassembler like ILSpy or Reflector. Is there some documentation for this library? If not, would it be possible to zip and upload it for us to have a look?
Chris
It is a bug of XIDE that it shows members on "Vegas:", ":" is used on instances of types only, is not valid on types themselves, so this should show nothing. But try a dot instead, to see the static members of the class, with "Vegas.", does the list now contain an entry like "Create", "CreateInstance" or something like that?
In any case, as others already pointed out, the fact that there does not exist a public constructor means that the developer of the class did not intend (and does not allow) to let the programmer create an instance of this class directly. Instead they must have provided another means of getting such an instance, but it's too hard to say how, without some documentation or without looking at the full contents of the dll in a disassembler like ILSpy or Reflector. Is there some documentation for this library? If not, would it be possible to zip and upload it for us to have a look?
Chris
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Calling a class that has no public constructor
Hello Fabrice,
I was just trying to translate a c# sample.
this is the sample :
using System;
using System.Text;
using System.Windows.Forms;
using ScriptPortal.Vegas;
namespace SampleScript1
{
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
MessageBox.Show(vegas.Version);
}
}
}
That is all. I can't generate code to run inside Vegas, when I have compiler errors. It is also very puzzling because when I type Vegas: the IDE shows me all the methods and accesses of Vegas.
#using System
#using System.Windows.Forms
#using ScriptPortal.Vegas
FUNCTION start() AS VOID
MessageBox.Show(Vegas:version) // error XS0120: An object reference is required for the non-static field, method, or property 'Vegas.Version'
RETURN
I was just trying to translate a c# sample.
this is the sample :
using System;
using System.Text;
using System.Windows.Forms;
using ScriptPortal.Vegas;
namespace SampleScript1
{
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
MessageBox.Show(vegas.Version);
}
}
}
That is all. I can't generate code to run inside Vegas, when I have compiler errors. It is also very puzzling because when I type Vegas: the IDE shows me all the methods and accesses of Vegas.
#using System
#using System.Windows.Forms
#using ScriptPortal.Vegas
FUNCTION start() AS VOID
MessageBox.Show(Vegas:version) // error XS0120: An object reference is required for the non-static field, method, or property 'Vegas.Version'
RETURN