{
try
{
XIndexContainer parentForm = (XIndexContainer)dbfTools.getParent( controlModel, XIndexContainer.class );
XEventAttacherManager manager = (XEventAttacherManager)UnoRuntime.queryInterface(
XEventAttacherManager.class, parentForm );
int containerPosition = -1;
for ( int i = 0; i < parentForm.getCount(); ++i )
{
XPropertySet child = dbfTools.queryPropertySet( parentForm.getByIndex( i ) );
if ( child.equals( controlModel ) )
{
containerPosition = i;
break;
}
}
manager.registerScriptEvent( containerPosition, new ScriptEventDescriptor(
interfaceName,
interfaceMethod,
"",
"StarBasic",
scriptCode