Am Dienstag, den 03.01.2006, 09:27 +0100 schrieb Frank Schönheit - Sun
Microsystems Germany:
> Hi Marc,

Hello Frank,

> > The IDL reference tells me about "css.script.registerScriptEvent":
> > ...
> > registers one event for an object identified by its index. 
> >         
> >         If any object is attached under this index, then this event is
> >         attached automatically. 
> > ...
> > 
> > I do not understand what object is in this context. Is it the main form
> > ("Standard") or is it the control aka. my button?
> 
> it's your button. More precise, it's the index of the button within its
> containing form. So,
>   oForm.registerScriptEvent(0, oEvents(0))
> registers events for the first child (because of the first "0") of oForm
> - which may or may not be your button.

Ah, I see. That seems to be no problem, because in this case I'm
building a document with some buttons in it programmatically. Since I
can control the naming of the buttons I think it will be possible to get
the index somehow.

> Normally, you'd expect some "getIndexInParent" (or so) method at your
> objects (buttons), but there is none (IIRC, there is some RFE requesting
> this).
> So, the algorithm would normally be (pidgin-Basic only)
>   Function getIndexInParent( oContainer, oObject )
>     For ( i = 0 to oContainer.getCount() )
>       If ( oContainer.getByIndex( i ) = oObject ) Then
>         getIndexInParent = i
>         Exit Function
>       End If
>     Next i
>     getIndexInParent = -1
>   End Function
> 
> However, I am not sure how to test equality of UNO objects in Basic, I'd
> suppose that "=" might not really work here. Perhaps there's a dedicated
> function for this.

Up to now I helped myself registering ActionListeners at each button,
but my search should have a more generic way. That way it works but
needs some more code.

Thank for help and a happy new year!
Marc



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to