7 messages in org.openoffice.fr.progRe: [prog] création et suppression de...
FromSent OnAttachments
JovialJul 12, 2004 5:11 am 
BobJul 12, 2004 5:16 am 
JovialJul 12, 2004 7:33 am 
JovialJul 12, 2004 7:36 am 
Agnès SimonetJul 12, 2004 9:58 am 
Tony GALMICHEJul 12, 2004 10:23 am 
JovialJul 12, 2004 1:00 pm 
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] création et suppression de controleActions...
From:Tony GALMICHE (tony@tiscali.fr)
Date:Jul 12, 2004 10:23:42 am
List:org.openoffice.fr.prog

Bonsoir Jovial,

Jovial a écrit :

Bonjour :-) Je recherche des informations ou exemple pour créer et supprimer par programmation un bouton de control et pouvoir gerer sa taille et sa position

J'ai trouvé le code ci-dessous sur OOoForum pour créer un bouton dans Calc.

En espérant avoir aidé.

Tony

-------------------------------------------------------- Sub formsincalc()

Dim aPos as new com.sun.star.awt.Point Dim aSize as new com.sun.star.awt.Size

odoc = thisComponent 'create a form.. oform = odoc.createInstance( "com.sun.star.form.component.Form" )

'get the drawpage of the first sheet and insert the form there.. osheet = odoc.getSheets().getByIndex(0) odrawpage = osheet.getDrawPage() odrawpage.Forms.insertByName("MyForm", oform)

'now create a Shape that will visualize the Buttonmodel button_shape = odoc.createInstance("com.sun.star.drawing.ControlShape")

'Position of it.. aPos.X = 5000 aPos.Y = 7000 button_shape.Position = aPos

'Size of it.. aSize.Width = 3000 aSize.Height = 1600 button_shape.Size = aSize

'now create a simple button for it.. button_model = odoc.createInstance("com.sun.star.form.component.CommandButton") button_model.Name = "CmdButton" button_model.Label = "Click here"

'now connect model and shape with each other button_shape.Control = button_model

'now insert it into the form.. odrawpage.Forms.getByName("MyForm").insertByIndex(0, button_model)

'now add it to the drawpage so that it becomes visible.. odrawpage.add(button_shape)

End Sub