no support for c++builder users.

edited 7:24PM in FastScript
I want to use the fastscript component on c++builder6.0.

how I can add the "AddMethod function" of fastscript component on cbuilder?

I tried it but it created some errors.

if you can solve this problem I will be glad.


Variant TForm1::CallMethod(TObject Instance,TMetaClass* ClassType , const String MethodName,Variant& Params)
{

//...
//...
return 1;
}

int TForm1::cBFunc(int x)
{

ShowMessage("ok");
return 0;
}

example:
fsScript1->AddMethod("int CBFunc(int x)", CallMethod);

Build Error:

[C++ Error] Unit1.cpp(83): E2034 Cannot convert 'Variant (* (_closure
)(TObject,TMetaClass *,const AnsiString,Variant &))(TObject,TMetaClass
*,const AnsiString,Variant &)' to 'Variant (_fastcall * (_closure
)(TObject *,TMetaClass *,const AnsiString,Variant &))(TObject *,TMetaClass
*,const AnsiString,Variant &)'
[C++ Error] Unit1.cpp(83): E2342 Type mismatch in parameter
'CallEvent' (wanted 'Variant (_fastcall * (_closure )(TObject *,TMetaClass
*,const AnsiString,Variant &))(TObject *,TMetaClass *,const
AnsiString,Variant &)', got 'void')

Comments

  • the function prototype is:

    Variant __fastcall ScriptFunction(TObject *pInstance, TClass ClassType, const AnsiString MethodName, Variant &Params);

    declare this in the "__published" section of the class defintion in the header file.

    This should work - I use BCB5, and this is how I got it working.

    Hope this helps
  • edited 7:24PM
    See my last reply in the post "Return Values to script methods". If you are still having trouble, e-mail me and I'll send you my code.

    John

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.