Dear Christian, > -----Original Message----- > From: Christian Junker [mailto:[EMAIL PROTECTED] > Sent: maandag 29 augustus 2005 21:22 > To: [email protected] > Subject: Re: [dev] starbasic variables and type declarations > > > Sven, > > 2005/8/29, Victoria, Sven <[EMAIL PROTECTED]>: > > > Note that I declared otxtfield of type Variant, not of type Object > > > because there are some rare situations where it would > fail declaring a > > > variable of type Object. > > > > ? > > Can you give more insight on this matter? > > I have never actually used Dim x as Object so I have no experience on > unexpected results. The Developer's Guide talks about prefering > Variant over Object so I just went that way not investigating on that > matter.
Ok, I have seen most examples (still) using Objects, so I figured you might have some insight info on this, on why it is not good to do so. > > > Doc = StarDesktop.CurrentComponent > > So Doc is a document ... ok ... but what can I do with a document? > > [...] > > Surely there must be more to a document than only these methods? > > But how do can I find this information from this point on? > > Sure there is, the thing is that the Starbasic interpreter takes a lot > of work away from you, as do other scripting interpreters. The Basic > engine actually binds all exported interfaces your referenced object > to it (behind the scenes). That's why you don't need to use > queryInterface calls that can frequently be seen in Java/C++ code, in > order to invoke a method. That the queryInterface() call is hidden is one thing I can only applaud. > > It would be really nice if on the the api page of OfficeDocument > > (or XComponent) references to subclasses (or > implementations) are included. > > It has! Click on the "Use" link that appears for every idl object at > the top. At some places the lists are not complete, so if you find an > interface that can be accessed from a certain object and its not > listed there, just file an issue for it. Ah! that's much better indeed. > > I guess that the Variant construction is the way to go :( > > There is nothing sad about it, if you choose well-named identifiers, > Starbasic should be one of the easiest programming languages to read > (+ understand) in my eyes. hmmm... (here i go again...) autocomplete would make it _really_ easy. I have read that with Java the NetBeans IDE can be set to include autocomplete on UNO objects. From the point of a Java programmer defining everything as Object (Variants) is then a no-no. As for a Basic programmer on the other hand it is indeed easier to define everything as Variant because it is easier <careful> however the ms office visual basic editor has autocomplete too <\careful>. You may wonder why I am poised on autocomplete? Editors are better at supplying the information I need rather then me searching for it i.e. I'm lazy. Nevertheless, thanx for the feedback, it was helpful. Best regards, Sven Victoria > -- > Best Regards > Christian Junker > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
