3 messages in org.openoffice.fr.progRe: [prog] Attacher par code un gesti...
FromSent OnAttachments
PhilippeMay 18, 2008 1:45 am 
Jean-MichelJun 18, 2008 4:37 am 
Jean-MichelJun 18, 2008 4:44 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] Attacher par code un gestionnaire d'événementà un boutonActions...
From:Jean-Michel (jmch@gmail.com)
Date:Jun 18, 2008 4:44:28 am
List:org.openoffice.fr.prog

2008/6/18 Jean-Michel <jmch@gmail.com>:

Le 18 mai 2008 10:46, Philippe <php@gmail.com> a écrit :

public sub NomBouton_actionperformed(e as object) 'on error resume next msgbox "Salut :" & e.source.model.name end sub

fonctionne...

plus précisément : (quelques confusions dans le nom de ton bouton dans ton code ;-) )

************************** dim mdlg as object ' ====================================================== Sub Main biblio=DialogLibraries.GetByName("Standard") oFrm=biblio.getByName("Dialog1") mdlg=createUNODialog(oFrm) call AjoutBouton( mdlg ,"monBtn" ,3 , 3 ,1) mdlg.execute End Sub

Sub AjoutBouton( dialogue as object,nomBouton as string, positionX as integer,positionY as integer)

Dim oDialogModel As Object , oButtonModel As Object NomObj = nomBouton oDialogModel = dialogue.Model oButtonModel = oDialogModel.createInstance("com.sun.star.awt.UnoControlButtonModel" )

With oButtonModel .Name = NomObj .Label = "affecter" .PushButtonType="STANDARD" .Tabstop = True .PositionX = positionX 'position horizontale .PositionY = positionY 'position verticale .Width = 27 'largeur .Height = 14 'hauteur End With oDialogModel.insertByName( NomObj , oButtonModel ) oButtonControl = dialogue.getControl(NomObj) cEventListenerName =NomObj oActionListener = CreateUnoListener( cEventListenerName + "_","com.sun.star.awt.XActionListener" ) oButtonControl.addActionListener( oActionListener ) End Sub public sub monBtn_actionperformed(e as object) msgbox "Salut :"& e.source.model.name end sub **************************

fonctionne