This item does not exist

Hello,

I am sure that I am missing something simple. After creating an example plugin with Visual Studio 2008 (Windows 7, Xojo Windows IDE), I cannot run the program and get the following error: This item does not exist, and the TestClass code is highlighted as follows:

[code] dim x as double
x = TestClass.DivideBy2(5)

msgbox "x = " + CStr(x)[/code]

Here is the code for the C++ Plugin

[code]// Example6-1.cpp
#ifdef _MSC_VER
#include “WinHeader++.h”
#endif

#include “rb_plugin.h”
#include “Example6-1.h”
#include <windows.h>

//The functions math
double DivideBy2(double x)
{
return x/2;
}

REALmethodDefinition testClassMethods[] = {
{ (REALproc)DivideBy2, REALnoImplementation, “DivideBy2(x as double) As Double” },
};

REALconstant testClassConstants[] = {
{ “Pi = 3.141592654” },
};

REALclassDefinition TestClass = {
kCurrentREALControlVersion,
“TestClass”,
0, // superName
0, // data size
0, // reserved for system use
NULL, // initializer
NULL, // deinitializer
NULL, // properties
0, // property count
testClassMethods, // methods
sizeof(testClassMethods) / sizeof(REALmethodDefinition), // method count
NULL, // events
0, // event count
NULL, // event instances
0, // event instance count
“TestInterface”, // interface(s)
NULL, // bindings
0, // bindings count
testClassConstants, // constants
sizeof( testClassConstants ) / sizeof( REALconstant ), // constant count
};

void PluginEntry(void)
{
REALRegisterClass(&TestClass);
}[/code]

[code]//Example6-1.h code
//Creates functions for the DLL Application
#include “WinHeader++.h”
#include “rb_plugin.h”

extern “C” {
double DivideBy2(double x);

}[/code]

When the example plugin code shipped with Xojo for VS2005 is compiled, the code works. My attempt is to make a class with a constant and a simple method.

Any helpful suggestions?

Thank you,

Eugene

you call a regular class method like a shared method.

i.e. you need:

[code]Dim x As Double
Dim myClass As New TestClass

x = myClass.DivideBy2(5)

MsgBox "x = " + CStr(x)
[/code]

Or, if you really want shared methods TestClass.DivideBy2(5) then see http://documentation.xojo.com/index.php/Plugin_SDK_Registration_Reference#REALclassDefinition for information on where shared methods should appear in your class definition.

Thanks Christian and Jeremy for the help. Unfortunately, the code does not appear to work. Using the suggested code in Xojo gives the following two errrors:

Window1.Pushbutton1.Action, line 2 - There is no class with this name
Dim myClass as New TestClass

Window1.Pushbutton1.Action, line 4 - This item does not exist
x = myClass.DivideBy2(5)

[code]Dim x As Double
Dim myClass As New TestClass

x = myClass.DivideBy2(5)

MsgBox "x = " + CStr(x)[/code]

The part which is unexplainable, is that the example with Xojo for Visual Studio calls the same methods, and treats a regular class like a shared method - except there are no errors.

Thoughts?

Sincerely,

Eugene

You put the plugin into the plugins folder and restarted xojo?

Hi Tim,

Yes, I put the plugin into the plugins folder and restarted Xojo. When typing out the line of code ‘x = myClass.’ the IDE was able to detect that DivideBy2 was a method.

Here is a link to the plugin that was built for Windows with the above code: Download rbx plugin example

Chuckle, I have previously missed something as simple as putting the plugin in the proper folder :slight_smile: Thanks for double-checking!

Sincerely,

Eugene

Has this issue been solved? I have this issue with the latest release. I am using VS2010. The IDE’s intellisense works, but the compiler says this class does not exist.

Thanks Rodd

The class is claiming to implement TestInterface, but the code you’ve posted doesn’t register it. Could this be the problem?

@ Joe R.

I get the same message when I build CompleteClass example. XOJO loads the plugin and intellisense works, but it will not compile the XOJO application.

Rodd J.

[quote=60470:@Rodd Johnson]@ Joe R.

I get the same message when I build CompleteClass example. XOJO loads the plugin and intellisense works, but it will not compile the XOJO application.

Rodd J.[/quote]

Can you upload the the built version of the plugin somewhere?

[quote=60470:@Rodd Johnson]@ Joe R.

I get the same message when I build CompleteClass example. XOJO loads the plugin and intellisense works, but it will not compile the XOJO application.

Rodd J.[/quote]

It looks like your plugin file has two DLLs inside of it, both of which register a class named “TestClass”.