Copy link to clipboard
Copied
Hello, I have a modeless dialog (palette) that is open in FM.
Is there a way to notify the dialog when the insertion point changes in the target document?
Looping through all tables in doc, but need to refresh the dialog if the user skips a table and selects the next one or last one.
Any help is greatly appreciated!
1 Correct answer
It is not clear to me, how the user loops through all tables.
But you'll get informed about changing insertion point via Notify Notification(Constants.FA_Note_PostMouseCommand,true);
Here is an example:
IMPORTANT: Dont forget to remove the notification when closing the dialog
var goDoc = app.ActiveDoc;
if (goDoc.ObjectValid())
{
var oDia = new Window("palette","ShowPgfFmt");
BuildDialogue();
Notification(Constants.FA_Note_PostMouseCommand,
...
Copy link to clipboard
Copied
It is not clear to me, how the user loops through all tables.
But you'll get informed about changing insertion point via Notify Notification(Constants.FA_Note_PostMouseCommand,true);
Here is an example:
IMPORTANT: Dont forget to remove the notification when closing the dialog
var goDoc = app.ActiveDoc;
if (goDoc.ObjectValid())
{
var oDia = new Window("palette","ShowPgfFmt");
BuildDialogue();
Notification(Constants.FA_Note_PostMouseCommand,true);
}
else
{
alert("No active document");
}
function BuildDialogue()
{
oDia.Group = oDia.add("group");
oDia.PgfName = oDia.Group.add("statictext",undefined,"");
oDia.PgfName.size = [240,40];
oDia.onClose = RemoveNotification;
oDia.show();
}
function Notify(note, object)
{
switch (note)
{
case Constants.FA_Note_PostMouseCommand:
{
ShowPgfName();
break;
}
}
}
function ShowPgfName()
{
oDia.PgfName.text = ReadPgfName();
oDia.update()
}
function ReadPgfName(locPgf)
{
var tRange = goDoc.TextSelection;
var locStartPgf = tRange.beg.obj.Name;
alert(locStartPgf);
return locStartPgf;
}
function RemoveNotification()
{
Notification(Constants.FA_Note_PostMouseCommand,false);
}
Copy link to clipboard
Copied
Thanks Klaus!
That worked as expected, just had to change this line of code:
function ReadPgfName(locPgf)
to
function ReadPgfName()
My script scans for all tables in flow, saves the table IDs in an array and the selects the first table. On the palette I have first, previous, next, and last buttons to allow the user to move through the tables array.
This request was meant for the user to be able to scroll to a different page (or table) and select the table he/she wants to modify and click on it, without using the navigation buttons. Your script will notify the palette and update the pointer in the array to sync the table properties shown on the palette with the selectes table on the page.
Thanks again, best regards!! 🙂

