Hi,

I setup a procedure in StarBasic and assinged this to the Open Document event for OpenOffice.org  via Tools>Configure.

Something  like this:

sub onOpenDocumentMain

  dim CurrentDB as variant

    CurrentDB = starDesktop.CurrentComponent
    Xray.Xray CurrentDB

'  if isNULL( thisComponent ) then
      ' odb file
'     CurrentDB = starDesktop.CurrentComponent
'     Xray.Xray CurrentDB
'  else
      ' other file type
'      print thisComponent.CurrentController.Frame.Title
'  endif

end sub

Now here is my problem. When I started, as you can see, I thought, "well just catch when thisComponent isNULL" . Of course as soon as there is some other document type open this fails because thisComponent is set. Not too mention that knowing this doesn't really help me, as I need to know whcich Base file is being opened.

So, then I went to the idea of using the StarDesktop as a way to catch this..but  this is not working either.

If I open an ODB file or other type, the procedure is called with these behaivors:

  • If an ODB is opened from Quickstarter (and no other documents are opened already) then Xray reports a NULL object twice.
  • If some other document type is opened (new file in other words) from quickstarter then the procedures seems to not be called at all. (Actually, I would like to understand why that is, but can live with the behavior - since I am only interested in catching when an existing ODB file opens )
  • If an ODB file is opened from FILE>Open menu of an exisiting documents window the procedure is called twice, but the CurrentComponent is the document that I used to open the menu. (I hope I made myself clear there)
  • If I open any other type of document the the procedure is called only once and the CurrentComponent is the newly opened document!

So, my question is this. Is there a way I can catch the event of an ODB document being opened. It does not have to be using Basic, I can work in Java if is requires some technique that StarBasic cannot handle. If I simply overlooked the answer in the Developers Guide I aplolgize, but I can't seem to find any real help with this there.

Thanks for any help you can offer.

Andrew 'Drew' Jensen





Reply via email to