Issue 52459 - API: Mutliple calls to assigned event handler for sub-form controls
Summary: API: Mutliple calls to assigned event handler for sub-form controls
Status: CONFIRMED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: 680m118
Hardware: All Windows XP
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-25 19:26 UTC by drewjensen.inbox
Modified: 2017-05-20 10:48 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
example files (24.54 KB, application/x-compressed)
2005-08-11 08:01 UTC, drewjensen.inbox
no flags Details
Date base showing event calls (10.07 KB, application/vnd.sun.xml.base)
2006-03-21 08:32 UTC, drewjensen.inbox
no flags Details
ODB file created under RC7 (11.81 KB, application/vnd.sun.xml.base)
2006-06-29 16:43 UTC, drewjensen.inbox
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description drewjensen.inbox 2005-07-25 19:26:31 UTC
This behavior only happens when the form is created from within a database
document. It does not happen if the form is created directly from writer.

I have a form document with some contols on it and I want to have a macro run
when the user double clicks in one of the controls. I can create a macro such as
In my case at hand it is a grid and I want the user to be able to "drill down"
to a pop form with detail information about the specific row entry.

Code:

sub catchclick( oEv as Object )
   if oEv.ClickCount > 1 then
      print "hello"
      endif
end sub


I assign this macro to the "Mouse Button Released" event of a control.

Now at this point everything happens as I would expect. I get a message box only
when I double click in the specific control.

However, I add a sub-form to my form document and purt some controls on the form
document from the sub-form. Now if I assign the macro to the "Mouse Button
Released" event of one of these controls, then the macro is called once for
every control at the main form level and once for the control at the sub-form
level. Every call to the macro carries, as best as I can tell, the exact same
source object.
Comment 1 Frank Schönheit 2005-07-26 07:16:22 UTC
Do you mind attaching a small sample database for easier reproduction?
Comment 2 drewjensen.inbox 2005-08-11 08:01:05 UTC
Created attachment 28646 [details]
example files
Comment 3 drewjensen.inbox 2005-08-11 08:01:31 UTC
I am attaching a database file and a macro library that demonstate the problem.

The database is named schooldays.odb and the library files are for a library
named dbutil.

In the database the form named COURSES will call the catchDblClick macro in the
library when you double click on the Student grid.

Double click on a cell in the grid and you will get the message box 9 times, one
for every control on the mainform and once for the grid.
Comment 4 Frank Schönheit 2005-08-23 09:53:29 UTC
thanks for this wonderful sample document!
Confirming, targeting, assigning.
Comment 5 drewjensen.inbox 2006-03-21 08:30:43 UTC
I think this related to this issue, if not I can always open another.

In working with 2.0.2 I have found a difference between the events Before Record
Change and After Recrod change.

Attached is another small test database, one table and one form. The form has
the Before Record Change and After Record Change events of the main dataform
control assigned to the follwoing sub procedures. ( if you create a new library
and name it Tasker the links will be fine, if you copy this into a different
library then of course you must change the forms defintion)

sub onBeforeRecordChange( oEvent as variant )
	print "Before Record Change"
	print oEvent.Source.ImplementationName
end sub

sub onAfterRecordChange( oEvent as variant )
	print "After Record Change"
	print oEvent.Source.ImplementationName
end sub

When Form1 is opened each of these procedures is called once, and each with a
source object of type com.sun.star.comp.forms.ODatabaseForm.

When you move to the second record however the difference arises. The procedure
onBeforeRecordChange will be called twice, the first time with a source object
of type com.sun.star.form.FmXFormController and the second time with
com.sun.star.comp.forms.ODatabaseForm. The onAfterRecordChange procedure is
called only once, with the source object of type ODatabaseForm. I assume the
later is correct and the former an error.

Comment 6 drewjensen.inbox 2006-03-21 08:32:05 UTC
Created attachment 35082 [details]
Date base showing event calls
Comment 7 Frank Schönheit 2006-03-28 09:20:57 UTC
adjusting summary so that we'll find it in the big "fix as much API bugs as
possible" sweep :)
Comment 8 drewjensen.inbox 2006-06-29 16:43:11 UTC
Created attachment 37429 [details]
ODB file created under RC7
Comment 9 Marcus 2017-05-20 10:48:04 UTC
Reset assigne to the default "issues@openoffice.apache.org".