Ariel Constenla-Haile wrote:
Hello Drew,

On Sunday 30 August 2009, 13:49, Drew Jensen wrote:
Ariel Constenla-Haile wrote:
Sub BtnPressed(oEvent as Object)
        Dim oControl as Object
        Dim oModel as Object

        oControl = oEvent.Source
        oModel = oControl.getModel()

End Sub


In this way, you can access the control and its model, and check what
button was pressed (by checking the control's model name, which is
unique; or by setting an action command to each button; etc. etc. use
your imagination)
Just one caveat.
The button names will be unique when you add them to a document via the
controls toolbar or a wizard - but there is no requirement that they be so.
Copy controls from one document to another and most likely they will not
be. So you (the macro programmer) must take care not break uniqueness as
you modify your controls if you intend to use the names in this fashion.

I guess you're talking about forms. But Johnny asked about dialogues, and here the control's model name is unique: the css.awt.UnoControlDialogModel is a container for control models and supports the css.container.XNameContainer interface, which throws a css.container.ElementExistException if the name is not unique.

ooops - yup - I was.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to