How to refresh DataSourceBrowser in a FrameControl

Fernand Vanrie <[email protected]> Tue, 07 Jun 2011 12:14:52 +0200
Newsgroups gmane.comp.openoffice.dba.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------090500000901020901050905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I try to use the "com.sun.star.frame.FrameControl" in a dialog acting as 
a "subforms'.

So i have 2 Framecontrol's  loaded with a dataSource browser based on a 
SQL-statement

When selecting a row in the first FrameControl the data in the second 
must been refreshed (passing a new SQL-statementto the second Framecontrol).

I found no way to do that because the activeCommand off the Resultset is 
"readonly".

now i use  this workaround:
' delete the FrameControl we want to refresh
  odlg.getcontrol("Grid2").dispose
' make  a new FrameControl
    oFrameControl2 = createUnoService("com.sun.star.frame.FrameControl")
    aLoaderArguments2(0).Name = "DataSourceName"
     aLoaderArguments2(0).Value = "mysql_native_PMG_reports"
     aLoaderArguments2(1).Name = "CommandType"
     aLoaderArguments2(1).Value = 2 'com.sun.star.sdb.CommandType.TABLE
     aLoaderArguments2(2).Name = "Command"
     aLoaderArguments2(2).Value = "SELECT distinct *   FROM  
pmgdbase.adv_reden_tbvips  WHERE pmgdbase.adv_reden_tbvips.REDENID = '" 
& sid &"'"
     aLoaderArguments2(3).Name = "ShowTreeView"
     aLoaderArguments2(3).Value = FALSE
     aLoaderArguments2(4).Name = "ShowTreeViewButton"
     aLoaderArguments2(4).Value = FALSE
     aLoaderArguments2(5).Name = "ShowMenu"
     aLoaderArguments2(5).Value = FALSE
' load the new FrameControl
   oFrameControl2.LoaderArguments = aLoaderArguments2
   oFrameControl2.ComponentUrl = ".component:DB/DataSourceBrowser"

Is there a better way to do that ?

Thanks

Fernand
-- 
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help

--------------090500000901020901050905
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <font face="Helvetica, Arial, sans-serif">I try to use the
      "com.sun.star.frame.FrameControl" in a dialog acting as a
      "subforms'.<br>
      <br>
      So i have 2 Framecontrol's&nbsp; loaded with a dataSource browser based
      on a SQL-statement<br>
      <br>
      When selecting a row in the first FrameControl the data in the
      second must been refreshed (passing a new </font><font
      face="Helvetica, Arial, sans-serif">SQL-statement</font><font
      face="Helvetica, Arial, sans-serif"> to the second Framecontrol).<br>
      <br>
      I found no way to do that because the activeCommand off the
      Resultset is "readonly".<br>
      <br>
      now i use&nbsp; this workaround:<br>
    </font><font face="Helvetica, Arial, sans-serif">' delete the
      FrameControl we want to refresh</font><br>
    <font face="Helvetica, Arial, sans-serif">&nbsp;odlg.getcontrol("Grid2").dispose
      <br>
    </font><font face="Helvetica, Arial, sans-serif">' make&nbsp; a new
      FrameControl</font><br>
    <font face="Helvetica, Arial, sans-serif">&nbsp;&nbsp; oFrameControl2 =
      createUnoService("com.sun.star.frame.FrameControl") <br>
      &nbsp;&nbsp; aLoaderArguments2(0).Name = "DataSourceName"<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(0).Value = "mysql_native_PMG_reports"<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(1).Name = "CommandType"<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(1).Value = 2
      'com.sun.star.sdb.CommandType.TABLE<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(2).Name = "Command"<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(2).Value = "SELECT distinct *&nbsp;&nbsp; FROM&nbsp;
      pmgdbase.adv_reden_tbvips&nbsp; WHERE pmgdbase.adv_reden_tbvips.REDENID
      = '" &amp; sid &amp;"'"&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(3).Name = "ShowTreeView"<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(3).Value = FALSE<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(4).Name = "ShowTreeViewButton"<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(4).Value = FALSE<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(5).Name = "ShowMenu"<br>
      &nbsp;&nbsp;&nbsp; aLoaderArguments2(5).Value = FALSE<br>
      ' load the new FrameControl<br>
      &nbsp; oFrameControl2.LoaderArguments = aLoaderArguments2<br>
      &nbsp; oFrameControl2.ComponentUrl = ".component:DB/DataSourceBrowser"<br>
      <br>
      Is there a better way to do that ?<br>
      <br>
      Thanks<br>
      <br>
      Fernand <br>
    </font>
  </body>
</html>

--------------090500000901020901050905--