Skip to main content
K.Daube
Community Expert
Community Expert
August 10, 2022
Question

How to determie switch from document to book window

  • August 10, 2022
  • 1 reply
  • 488 views

I have set up notifications to determine the switch between book and document for these triggers:

105 FA_Note_PostActiveDocChange
   2 FA_Note_PostOpenDoc
 77 FA_Note_PostBookComponentOpen
 17 FA_Note_PostOpenBook

Now, when switching between nothing (aka Welcome screen), book window and document window I get mixed results.

  • Nothing → Book: Notify is triggered by FA_Note_PostOpenBook
  • Nothing → Open document: Notify is triggered by FA_Note_PostOpenDoc and
    FA_Note_PostActiveDocChange
  • Document → Open Book: Notify is triggered by FA_Note_PostOpenBook
  • Book → Document: Notify triggered by FA_Note_PostActiveDocChange
  • Document → Book: Notify is not triggered. Which constant is required?

 

Any ideas, how determine whether I have left the document window and entered the book window?

 

There must be a method. The open FM Find/Change dialog switches from document to book indication when I leave the document window and click into the book window.

This topic has been closed for replies.

1 reply

Legend
August 12, 2022

Hi Klaus, on FM2019 I see FA_Note_PostActiveDocChange triggered for every combination that you list. In fact, it is sometime triggered multiple times when switching to and from "nothing."

 

How are you testing this? I did something very simple... I imagine you are doing the same.

 

Notification(Constants.FA_Note_PostActiveDocChange , true);

 

. . .

 

function Notify(note, object, sparam, iparam)
{
  switch (note)
  {
    case Constants.FA_Note_PostActiveDocChange:
      alert("Doc change");
      break;

  }

}

 

When testing, I would recommend that you restart FM between any change in notification setup. I feel that I have experienced unpredictable behavior trying to change notifications while FM is running.

 

Russ

K.Daube
Community Expert
K.DaubeCommunity ExpertAuthor
Community Expert
August 12, 2022

Thank You, Russ, for your comments

«When testing, I would recommend that you restart FM between any change in notification setup.»

Yes this is absolutely essential - and it seems to be also important to close FM orderly so that

    case Constants.FA_Note_PreQuitSession:
      KLD_F.RemoveNotifications ();
      break;

is also executed and the notifications be removed. I have found that they survive if FM is just killed.

I have tested again:

Both a book and a document are open

Activating (cklich into) the book window does not trigger FA_Note_PostActiveDocChange. Leaving the document focus obviously is not a "change", although the document is no more active.

Activating the document of course does.

I have no idea how to get a notification when the user leaves the document and enters the book window. In a Find panel the radio buttons ("find in")  Book or Document should be automatically set from the situation (FM standard Find/Repl does).

Legend
August 12, 2022

Hi Klaus, I just checked again to be sure. I get notification when I leave the document and enter the book window. In fact, I get a double notification. I did not investigate why there are two. Maybe I'm getting your notification by accident 🙂

 

Jokes aside, I'm not sure what else to say, what could be different from your setup. As a reminder, I'm using FM2019, but I don't suspect that has anything to do with it.

 

Russ