How to connect my own listener to a Form RowSet ?

classic Classic list List threaded Threaded
1 message Options
Patrick Gelin Patrick Gelin
Reply | Threaded
Open this post in threaded view
|

How to connect my own listener to a Form RowSet ?

Hi,

I would like to manage a Form into a pseudo Basic Object. I Writed a
pseudo object to test (Bellow). I know a Form could be used with RowSet
interface, but in the code bellow there is a problem in Sub Ecouter()
with line :

_FormRowSet.addRowSetApproveListener(_ecoute1)

The error is that _FormRowSet. doesn't support
addRowSetApproveListener() call ...

I don't know if the problem comme from the fact listeners could not be
methods of pseudo object, or if the RowSet interface into a form is not
completed ...

I know also I could clone the RowSet service of a form but it's read
only. What I'm looking for is to listen the origin rowset of my form
with read/write ...

Do you think it's possible ?

Thank you for your help !

Patrick



REM  *****  BASIC  *****
Option Compatible
Option ClassModule

Option Explicit

Private _FormRowSet As variant
Private _ecoute1 As Variant
Private _ecoute2 As Variant

Private Sub Class_Initialize()
End Sub

Private Sub Class_Terminate()
End Sub

Rem
***************************************************************************
Rem
Rem PROPRIETES
Rem
Rem
***************************************************************************


Rem
***************************************************************************
Rem
Rem METHODES PRIVEES
Rem
Rem
***************************************************************************


Rem
***************************************************************************
Rem
Rem METHODES PUBLIQUES
Rem
Rem
***************************************************************************

Public Sub Ecouter(FormRowSet As Variant)

     On local Error Goto Error_Sub

     _FormRowSet = FormRowSet

     _ecoute1 = CreateUnoListener("TVFAPEcouteAvant_",
"com.sun.star.sdb.XRowSetApproveListener")
     _FormRowSet.addRowSetApproveListener(_ecoute1)

     _ecoute2 = CreateUnoListener("TVFAPEcouteApres_",
"com.sun.star.sdbc.XRowSetListener")
     _FormRowSet.addRowSetListener(_ecoute2)

Exit_Sub:
     On error resume next
     Exit Sub
Error_Sub:
     TraceError("ERROR", Err, Name, Erl)
     Stop
End Sub

Public Sub ArreterEcoute()
     _FormRowSet.removeRowSetApproveListener(_ecoute1)
     _FormRowSet.removeRowSetListener(_ecoute2)
End Sub

' ------------ GESTIONNAIRES DES EVENEMENTS XROWSETAPPROVELISTENERE
-----------

Function TVFAPEcouteAvant_approveCursorMove(event As Object) As Boolean

     MsgBox "TVFAPEcouteAvant_approveCursorMove"

     TVFAPEcouteAvant_approveCursorMove = true
End Function

'-------------------------------
Function TVFAPEcouteAvant_approveRowChange(event As Object) As Boolean

     MsgBox "TVFAPEcouteAvant_approveRowChange"

     TVFAPEcouteAvant_approveRowChange = true
End Function

'-------------------------------
Function TVFAPEcouteAvant_approveRowSetChange(event As Object) As Boolean

     MsgBox "TVFAPEcouteAvant_approveRowSet"

     TVFAPEcouteAvant_approveRowSetChange = true
End Function

'-------------------------------
Function TVFAPEcouteAvant_disposing(event As Object) As Boolean

     MsgBox "TVFAPEcouteAvant_disposing"

     TVFAPEcouteAvant_disposing = true
End Function

' ---------------- GESTIONNAIRES DES EVENEMENTS XROWSETLISTENERE
---------------

Sub TVFAPEcouteApres_cursorMoved(event As Object)
     MsgBox "TVFAPEcouteApres_cursorMoved"
End Sub

'-------------------------------
Sub TVFAPEcouteApres_RowChanged(event As Object)
     MsgBox "TVFAPEcouteApres_RowChanged"
End Sub

'-------------------------------
Sub TVFAPEcouteApres_RowSetChanged(event As Object)
     MsgBox "TVFAPEcouteApres_RowSetChanged"
End Sub

'-------------------------------
Sub TVFAPEcouteApres_disposing(event As Object)
     MsgBox "TVFAPEcouteApres_disposing"
End Sub



--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy