0

I have multiple views in a perspective, these are shown as tabs. I want to catch the event when I switch from one Part to another (by clicking on the other parts tab). In other words I want to catch the event when a part looses focus. How can I do that in E4?

I have tried IPartListener implementation but its methods are called twice and also too late. For example, if I have parts A and B and part A is in focus, when I click on tab for part B, the @Focus method of part B is called first and then part deactivated (or part hidden) method of IPartListener is called for part A. I do not want that. Also, I have noticed that the partActivated and partDeactivated methods are called twice (for each part), which is also not desireable.

Any help would be greatly appreciated.

Thanks, Jehan

Jehan Zeb
  • 155
  • 12
  • 1
    I don't see any annotations called `@PartActivated` or `@PartDeactivated` in e4. – greg-449 Oct 26 '15 at 10:35
  • Sorry for the mistake, these are not annotations, they are methods of `IPartListener` implementation. – Jehan Zeb Oct 26 '15 at 10:49
  • I don't see partActivated being called twice in my app. – greg-449 Oct 26 '15 at 10:54
  • Ok. But for me it is called twice, however this is not such an important issue. The main thing is calling order of part deactivation and `@Focus`. Is there are way to capture event 'onclick' on tab of a part? – Jehan Zeb Oct 26 '15 at 10:59
  • What is it you actually want to do? – greg-449 Oct 26 '15 at 11:11
  • I want to ask the user if he wants to save the changes (if the part he is leaving is dirty). The user has 3 options: 1) save changes and switch to other part, 2) don't save changes but still switch to the other part and 3) cancel and don't leave the current part. – Jehan Zeb Oct 26 '15 at 11:51
  • If you actually want to stop the part switch you will probably have to do a custom part stack renderer – greg-449 Oct 26 '15 at 12:10
  • Even implementing the custom part stack renderer only gives me control to activate() method.. nothing else useful... – Jehan Zeb Oct 26 '15 at 14:23

0 Answers0