Hi,

Two quick questions.

I would like to be able to recognize, in a script, when it was called with
the QueryDesign window on top.

Currently I have this code:

REM
--------------------------------------------------------------------------------

function getQDCurrentCommand( QryDesigner as variant ) as string
   dim oQryCtlr as variant

   getQDCurrentCommand = ""

   if isQueryDesigner( oQryCtlr ) then

       getQDCurrentCommand = oQryCtlr.ActiveCommand

   end if

end function

function isQueryDesigner( Qry as variant ) as boolean
 dim oCurrModel as variant

 isQueryDesigner = False

 oCurrModel = stardesktop.currentframe.controller.model

 if oCurrModel.supportsService( "com.sun.star.sdb.OfficeDatabaseDocument" )
then

   if oCurrModel.CurrentController.SupportsService( "
com.sun.star.sdb.QueryDesign" ) then

     Qry = oCurrModel.CurrentController

     isQueryDesigner = True

   end if

end if

end function

REM
--------------------------------------------------------------------------------

Two issues come up.

First - isQueryDesigner will recoginize the QueryDesign window If and ONLY
if it is sitting directly on top of the BaseDocument window. Is there some
other, better, way to get a reference to this windows controller object? Now
before you say - Well of course, you test for the databasedocument first -
but I have not figured out how to get to the QueryDeisn window startig with
stardesktop object - I must be missing something simple here.

Second - The ActiveCommand property of the seems to return the command
string at the time the query was last saved - not reflecting any changes
made during the current editing session. A new query that has not been saved
yet returns an empty string for example.

Thanks

Drew

Reply via email to