Merci Fabien, That solution worked very well. I had thought that you only needed to export classes when using them for a component ? (from the Gambas Wiki on Components - Which is the only reference I can find to exporting classes.)
One other question. So what would Class.Load be used for ? Ian. On 02/11/14 16:30, Fabien Bodard wrote: > Just one question ... have you exported those classes ? > > tmpClass is just a class ... not an instanciate object > > You need to call Object.New > > Or just new > > > Public Sub Main() > Dim hObj As Object > Dim sSym As String > For Each sSym In Classes["MyClass"].Symbols > Print sSym > Next > > hObj = Object.New("MyClass") > > Object.Call(hObj, "CreateFile", ["Hi World"]) > > End > > 2014-11-02 5:01 GMT+01:00 Ian <ian.ro...@eftel.com.au>: >> Class.Load allows you to create a reference to a named class. >> >> Dim TempClass as Class >> TmpClass = Class.Load("myclass") >> >> This works and I can get the names of the public instances of variables >> and procedures >> >> For each TmpString in TmpClass.Symbols >> Message(TmpString) >> Next >> >> Is there a way to call a Procedure or Function from the named class and >> pass it any parameters that it requires? >> >> ie: if I have a procedure in a valid class I have created called Public >> Sub DoSomething(InStr as string) >> can I call this function from TmpClass somehow >> (or is this just a 'read only' reference to the loaded class?) >> >> >> I tried Object.Call(TmpClass, "NameOfProcedure", TmpAry) >> with TmpAry[] containing the name of a single string parameter I wish to >> pass. >> This returns the error: "Can't find {NameOfProcedure} in Class 'Class' >> >> Context: In each of my projects created classes, I have a standard >> Procedure to save the applicable database table records to a binary file >> called CreateBinaryFile(InPath as String) >> This is the process I am trying to call for each class that I have created. >> >> >> Cheers, >> Ian Roper. >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user > > ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user