Hi,

A second thought on all this, if I may.

Lets say that thisComponent will be left unchanged, so when the Basic library is embedded in a Base document thisComponent will refer always to the Base Document.

First - this is a plus compared to what we have today, IMO, because it gives a very nice, consistent way to get to the Base document we are currently working with.

Second - The Developers Guide states that thisComponent when used in application wide Basic is equivalent to StarDesktop.CurrentComponent. Fine so when we create our Basic code and we have to deal with a procedure assigned from a menu we can just use this instead.

Using 2.3.1 and testing this by creating a procedure that simply calls StarDesktop.CurrentComponent

With only a Base document open on the desktop, and nothing else this returns an object of type
com.sun.star.comp.dba.ODatabaseDocument

If I open a form in and then call this procedure it returns a
SwXTextDocument

Open a Report Builder report in design mode
com.sun.star.comp.report.OReportDefinition

Execute a report ( wizard or builder )
SwXTextDocument

Open a Table Design window
org.openoffice.comp.dbu.OTableDesign

If I then open a Query Designer and call the procedure an object of
org.openoffice.comp.dbu.OQueryDesign

So far this is looking pretty good.

Now if I close everthing but the Base document and then open any other document, switch back to the Base document and call it
com.sun.star.comp.dba.ODatabaseDocument

Still good I suppose

But now - open an embedded form, switch back to the Base document and call it:
SwXTextDocument

This is the current problem, IMO, however with the Basic in the Base file and the current definition of thisComponenet used, then you see why I say it is a plus. Now the macro developer has a workable way to get what they really want.

So, when I look at that I wonder do we really need to change how thisComponent is defined and do we really need a new psuedo variable even?

One last thing - I took some time and went back to OOoForum and did a search for the use of thisComponent in posts - both questions and responses and code snippets. Interestingly one can find, none scientific of exhaustive, that it seems to be used much less frequently on the Base forum then on the others ( Calc, Writer, Macro ) - It is not uncommon in the Base forum posts to see the use of the Event Structure.

I believe there are two reasons for this:

First - most end users learn macro programming from examples. What is the great teacher here. It is the keyboard macro recorder and that uses thisComponenet. But you can't use that in Base so folks that have come to OpenOffice.org since 2.0 and started using Base did not have this as a norm. Also with the first Base release thisComponent was problematic, IRCC.

Second - With Writer and Calc it is often the case ( writer more so ) that what one wants is the document reference. With a data entry form it is not the case, almost never, what is wanted is a control, the result set or the datasource.

Anyway - just another thought on this.

Drew


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to