4 messages in org.openoffice.fr.progRe: [prog] Calc - boutons macro
FromSent OnAttachments
LE MOULEC JacquesMay 4, 2007 12:09 am 
oo...@volcar.orgMay 4, 2007 9:39 am 
oo...@volcar.orgMay 4, 2007 9:45 am 
Bernard MarcellyMay 4, 2007 11:20 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:Re: [prog] Calc - boutons macroActions...
From:oo...@volcar.org (oo@volcar.org)
Date:May 4, 2007 9:39:32 am
List:org.openoffice.fr.prog

Selon LE MOULEC Jacques <jacq@cnasea.fr>:

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 ?)

button_model.backgroundcolor = rgb(255,128,255)

le Tag correspond à la bulle d'aide qui s'affiche au passage de la souris sur le controle.

2- mettre la police du titre (Label) en gras button_model.FontWeight = 150 3- ... et toutes autres informations utiles.

Merci.

Francois Gatto