5 messages in org.openoffice.fr.prog[prog] Petites modifs sur la version 3
FromSent OnAttachments
FabienOct 14, 2008 12:02 am 
Bernard MarcellyOct 14, 2008 2:27 am 
fabs...@wanadoo.frOct 14, 2008 2:58 am 
fabs...@wanadoo.frOct 14, 2008 3:51 am 
Bernard MarcellyOct 14, 2008 5:19 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[prog] Petites modifs sur la version 3Actions...
From:Fabien (fabs@wanadoo.fr)
Date:Oct 14, 2008 12:02:21 am
List:org.openoffice.fr.prog

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,