Bonjour,

Je cherche les fonctionnalites pour creer un bouton macro en mode programmation.

J'ai trouve, en tatonnant + avec le livre OOo programmation (version 1) les elements suivants :

Sub bouton

Dim Feuille as object, PageGraphique as object, TypeBouton as object
Dim button_model as object, monForm as object
Dim aPos as new com.sun.star.awt.Point
Dim aSize as new com.sun.star.awt.Size
dim unEvent as new com.sun.star.script.ScriptEventDescriptor

Feuille = ThisComponent.Sheets.getByName("Feuille1")
PageGraphique = Feuille.getDrawPage()
TypeBouton = ThisComponent.createInstance("com.sun.star.drawing.ControlShape")

'Position en 1/1000 de pouce => 1 pouce = 2540
aPos.X = 17500
aPos.Y = 500
TypeBouton.Position = aPos
'Taille
aSize.Width = 6000
aSize.Height = 1600
TypeBouton.Size = aSize

button_model = ThisComponent.createInstance("com.sun.star.form.component.CommandButton")
button_model.Name = "PushButton"
button_model.Label = "Edition"
'button_model.Tag = 16711935
button_model.FontHeight = 15    'taille police
button_model.FontName = "Arial"    'nom police

'button_model.Tag = RGB(0,0,0)
button_model.HelpText = "Mise à jour de la valeur du stock dans la fiche principale"

TypeBouton.Control = button_model
PageGraphique.add(TypeBouton)

'unEvent.ListenerType = "com.sun.star.awt.XMouseListener"
'unEvent.EventMethod =  "mouseReleased"
'unEvent.ScriptType = "StarBasic"
'unEvent.ScriptCode = "ArmOOor601.Module2.Test"

'monForm = PageGraphique.Forms.getByName( "Standard")
'monForm.registerScriptEvent(monForm.Count - 1, unEvent)

End Sub

il me manque :
1- affecter une couleur au bouton (qu'est-ce que button_model.Tag ?)
2- mettre la police du titre (Label) en gras
3- ... et toutes autres informations utiles.

Merci.


***********************************************************************************************************************
Ce message peut contenir des INFORMATIONS CONFIDENTIELLES destinées à l'usage exclusif du destinataire. Si vous le receviez par erreur, merci de bien vouloir nous en avertir immédiatement par téléphone ou messagerie,de le détruire et de n'en divulguer le contenu à personne.

This message may contain CONFIDENTIAL INFORMATION intended only for use by the addressee. If you have received it by mistake, thank you for notifying us immediately by telephone or by e-mail,and please, delete it and do not deliver it to anyone else.
***********************************************************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Répondre à