Hello Frank,

So the (bindable) controls on the form are not XDatabaseParameterListeners
themselves?

That kind of defeats the whole mechanism. :-(

I vote for a way to bind the control to a listener instead of to the
datasources column without programming. It shouldn't be that hard. When the
datasources colum doens't exist a listener should be created automatically.
Or...?

An easier way to do the below is using com.sun.star.sdbc.XParameters
whenever the unbound filter control changes.

Or could the method be used to communicate control values across forms? So 1
window with filter controls, and another with the filtered form results?



Ferry

> As I understood from the SDK (see DevelopersGuide chapter 13.5.1 section
> Parameters) it are the controls that need to be added to some list of
> listeners (using com.sun.star.form.XDatabaseParameterBroadcaster) so that
> they get resolved when the query runs (done by
> com.sun.star.form.XDatabaseParameterListeners).

Hmm, the guide might not be ... strictly correct there.

You cannot add the controls as listeners. What you can do is to create a
listener instance in Basic
  oListener = createUnoListener( _
    "paramListener_", "com.sun.star.form.XDatabaseParameterListener" );

You need a function "paramListener_approveParameter( oEvent as Object )
as Boolean", which is associated with the listener then. See
http://api.openoffice.org/docs/common/ref/com/sun/star/form/XDatabaseParamet
erListener.html#approveParameter
for the meaning.

Add this listener to the logical form which displays your data:
  oForm.addDatabaseParameterListener( oListener )

Then, every load/reload of your form will call the above-mentioned
function. Both of the above should be done in the OnLoad event of the
document.

> - Is this the same parameter listener that you refer to?

Yes.

> - but since the exercise is to use the controls as a filter I wouldn't
want
> to reload the form

In the above function, you need to query the current values of your
dedicated controls, and fill them into the proper slots of the
DatabaseParameterEvent (the above oEvent).

> - note: MS Access needs a Requery (re-run the query) in this case, which
> would be macro command attached to the controls on change event
>
> I really believe that such a simple task as this should be possible
without
> programming and have always been irritated by MX Access requiring a
requery
> macro.

Well, this is similar in Base. You need to have an additional Sub in
Basic which is bound to the controls "modified" event. In this function,
you need to reload the form (oForm.reload), which is effectively the
same as MSA's Requery.

I know the above is a rough sketch only, let's see how we can refine it
together :)

Ciao
Frank

--
- Frank Schönheit, Software Engineer         [EMAIL PROTECTED] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

Reply via email to