()
| 50 | } |
| 51 | |
| 52 | func (p *EventPublisher) Publish() { |
| 53 | // This is a kludge to find the form that the event publisher is |
| 54 | // affiliated with. It's only necessary because the event publisher |
| 55 | // doesn't keep a pointer to the form on its own, and the call |
| 56 | // to Publish isn't providing it either. |
| 57 | if form := App().ActiveForm(); form != nil { |
| 58 | fb := form.AsFormBase() |
| 59 | fb.inProgressEventCount++ |
| 60 | defer func() { |
| 61 | fb.inProgressEventCount-- |
| 62 | if fb.inProgressEventCount == 0 && fb.layoutScheduled { |
| 63 | fb.layoutScheduled = false |
| 64 | fb.startLayout() |
| 65 | } |
| 66 | }() |
| 67 | } |
| 68 | |
| 69 | for i, h := range p.event.handlers { |
| 70 | if h.handler != nil { |
| 71 | h.handler() |
| 72 | |
| 73 | if h.once { |
| 74 | p.event.Detach(i) |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | } |
no test coverage detected