Selon LE MOULEC Jacques <[EMAIL PROTECTED]>:
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]