Bonjour,

Je viens de constater quelques changements de comportement de mes macros sous 
ooo3
Je les relaye à tout hasard.

Avant, pour supprimer une bibliothèque, j'utilisais la fonction suivante:

Sub DeleteBasicLibrary(srcname)
Dim SrcLibraryName As String
Dim oSrcLib As Object, iCounter As Integer
Dim oLib As Object, oGlobalLib As Object
Dim iLib As Integer
Dim sSrcModules
SrcLibraryName = srcname
oGlobalLib = GlobalScope.BasicLibraries
For iLib = 1 To 2 ' this makes two passes, one for the dialogues and one for 
the macros
        If oGlobalLib.hasByName( SrcLibraryName ) Then
                oSrcLib = oGlobalLib.getByName( SrcLibraryName )
                sSrcModules = oSrcLib.getElementNames()
                iCounter = lBound( sSrcModules() )
                while( iCounter <= uBound( sSrcModules() ) )

                        oSrcLib.removeByName( sSrcModules(iCounter) )           
'<-- une erreur apparaît 
maintenant ici: la bibliothèque n'est pas chargée.

                        iCounter = iCounter + 1
                wend
                oGlobalLib.removeLibrary( SrcLibraryName )
        End If
        oGlobalLib = GlobalScope.DialogLibraries
Next iLib
End Sub


Ca marchait très bien.
Maintenant, j'ai un message d'erreur me disant que la bibliothèque n'est pas 
chargée.

Je rajoute donc une ligne pour charger la bibliothèque.
Ce qui m'étonne par contre, c'est que si je charge la bibliothèque au début de 
la fonction, ça ne marche toujours pas, alors que si je la charge juste avant 
l'erreur, ça marche.

Ceci ne marche pas:

Sub DeleteBasicLibrary(srcname)
Dim SrcLibraryName As String
Dim oSrcLib As Object, iCounter As Integer
Dim oLib As Object, oGlobalLib As Object
Dim iLib As Integer
Dim sSrcModules
SrcLibraryName = srcname
oGlobalLib = GlobalScope.BasicLibraries

oGlobalLib.LoadLibrary( SrcLibraryName )                        '<--- j'ajoute 
cette ligne. Ca ne 
marche toujours pas. C'est peut-être maladroit de charger une bibliothèque 
avant de vérifier qu'elle existe, cependant, quand elle existe, je ne vois 
pas pourquoi la suite plante.

For iLib = 1 To 2 ' this makes two passes, one for the dialogues and one for 
the macros
        If oGlobalLib.hasByName( SrcLibraryName ) Then
                oSrcLib = oGlobalLib.getByName( SrcLibraryName )
                sSrcModules = oSrcLib.getElementNames()
                iCounter = lBound( sSrcModules() )
                while( iCounter <= uBound( sSrcModules() ) )
                        oSrcLib.removeByName( sSrcModules(iCounter) )
                        iCounter = iCounter + 1
                wend
                oGlobalLib.removeLibrary( SrcLibraryName )
        End If
        oGlobalLib = GlobalScope.DialogLibraries
Next iLib
End Sub

Ceci marche:


Sub DeleteBasicLibrary(srcname)
Dim SrcLibraryName As String
Dim oSrcLib As Object, iCounter As Integer
Dim oLib As Object, oGlobalLib As Object
Dim iLib As Integer
Dim sSrcModules

SrcLibraryName = srcname

oGlobalLib = GlobalScope.BasicLibraries
For iLib = 1 To 2 ' this makes two passes, one for the dialogues and one for 
the macros
        If oGlobalLib.hasByName( SrcLibraryName ) Then
                oSrcLib = oGlobalLib.getByName( SrcLibraryName )
                sSrcModules = oSrcLib.getElementNames()
                iCounter = lBound( sSrcModules() )

                oGlobalLib.LoadLibrary( SrcLibraryName )        '<-- J'ajoute 
la même ligne ici, 
ça marche.

                while( iCounter <= uBound( sSrcModules() ) )
                        oSrcLib.removeByName( sSrcModules(iCounter) )
                        iCounter = iCounter + 1
                wend
                oGlobalLib.removeLibrary( SrcLibraryName )
        End If
        oGlobalLib = GlobalScope.DialogLibraries
Next iLib
End Sub


J'avoue que je ne comprends pas très bien. M'enfin, ça fini par marcher...

Autre changement: dans une boite de dialogue, j'ai des cases à cocher. Il y en 
a que je ne voulais pas afficher, et pour cela j'utilisais le code suivant:

                Label = BoiteDialogue.GetControl("CheckBox"&CStr(i))
                Label.Model.Height = 0

Maintenant, ça ne marche plus. Par contre, ceci marche:

                Label = BoiteDialogue.GetControl("CheckBox"&CStr(i))
                Label.Model.Width = 0

On ne peut donc plus fixer la hauteur d'une case à 0, mais seulement sa 
largeur.

Tout ceci n'est pas bien grave et je remercie toujours chaleureusement les 
développeurs.

C'est juste pour le signaler.

Cordialement,

Fabien.


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

Répondre à