Re: scripting with bonobo


On Wed Jun 28, 2000 at 04:45:25PM -0400, Miguel de Icaza wrote:

> > Now, the interesting thing is of course how to get application
> > specific stuff in your scripting environment, e.g. your 'Sheet'-object.
> > To do that, we can add another method to EmbeddableLanguage:
> > 
> > 	  void add_object ( in Unknown unk, in string known_as );
> You really do not need to do this, as you would be able to query
> objects and load interface definitions from either the IR or the IDL
> file.
> So the top level object you pass to "initialize" (your Host) would
> basically implement your toplevel object, and from there you could
> walk the tree of objects.  Something like:
> 	workbook = host.query_interface ("IDL:Gnumeric/Workbook:1.0");
> 	sheet = workbook.get_sheet (0);

Well, the add_object method gives you the opportunity to insert object
refs with no directly relation to your one, single host object.
In Python and Perl you could get such refs to *new* objects by
creating them 'by hand' (i.e. creating a reference to IDL:Evolution/Message:1.0); 
however, in VBScript/JavaScript (on MS platform), there is no
way to do 'CreateObject()' or something (unless you add such method
yourself). So, all the objects that are available inside the scripting
environment are precisely those you have injected into it - this is
very nice from a security viewpoint. I guess 'gb' could be adapted to
work this way.

Also, your host app may have more than one *specific* instances it may
want to inject into the scripting environment. For example in the
Gnumeric case I could think of a 'script console window' in which
scripts throw output (like the Java console in Netscape). You want to
share the reference to this console window across scripts, but it's
surely not accesible through the Gnumeric object model.


          Dirk-Jan C. Binnema <> 
                 PGP/GPG fingerprint:
 BB49 41D7 053D E5F1 F333 586E C530 CBC3 4352 A39F

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]