Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing |
Summary: | "when receiving focus" event calls assigned macro infinite times | ||
---|---|---|---|
Product: | Base | Reporter: | jasktron <jasktron> |
Component: | code | Assignee: | AOO issues mailing list <issues> |
Status: | CLOSED NOT_AN_OOO_ISSUE | QA Contact: | |
Severity: | Trivial | ||
Priority: | P3 | CC: | issues, oooforum |
Version: | OOO320m18 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Latest Confirmation in: | --- |
Developer Difficulty: | --- |
Description
jasktron
2010-10-05 22:29:39 UTC
somehow I bet that within your macro code, you open a modal dialog box, or something like this ... The problem usually is that your macro does something which steals the focus from the control, and when the focus is implicitly given back (e.g. because the dialog is closed), then this of course triggers a new event ... The problem in detail is the following (ooo Base): 1) place a text control (or a listbox...) in a form, assign the following sample macro to the "when receiving focus" event: Sub Test msgbox "Test!" End Sub 2) when the control receive focus, the "Test!" alert repeats infinite times and hangs the application The macro really I used is the following: Sub sqlcats Dim current_IDcatp as Integer Dim current_IDcats as Integer formdoc = ThisComponent oform = formdoc.DrawPage.Forms.getByName("form1") osubform = oform.getByName("subform3") ogrid = osubform.getByName("attrcat_grid") octl = ogrid.getByName("catp") current_IDcatp = octl.BoundField.value octl = ogrid.getByName("cats") octl.ListSourceType=com.sun.star.form.ListSourceType.SQL octl.ListSource = Array("SELECT ""label"", ""IDcats"" FROM ""cat-sec_tbl"" WHERE ""cat-sec_tbl"".""IDcatp"" = " & current_IDcatp) octl.refresh() End Sub Does this macro steal also the focus causing the event re-triggering? When the listbox control is focused, the internal content flickers. The strangeness is that after moving the focus with the arrow keys between the fileds of subform grid, the content of listbox sometimes returns normal and sometimes doesn't. this issue slipped my attention for a while - sorry! No, your second macro does not contain any obvious reasons for an infinite event calling. Well, the refreshing of the list box might be a not-so-obvious one ... To be sure to investigate the right thing: Do you mind creating a small, self-contained database document with your macro, which shows the problem? I think one thing we could do is to disallow nested event firing - that is, if the first event is still running, subsequent requests to fire the same event should be ignored. This could fix the problem - but I'd like to see the bug in action before embarking on this. Agreed with Franck Call a msgbox is a bad thing Because once closed, the focus will be back to previous control. So infinity loop is a normal behavior in this case |