cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Translate the entire conversation x

Inconsistent tag visibility when Editor started from Windows Start vs another application

ehood
10-Marble

Inconsistent tag visibility when Editor started from Windows Start vs another application

Product: Arbortext Editor 8.2.2.1

 

I am working on an application that interacts with Editor, mainly the ability to tell editor to open specific documents and to specific locations in those documents.

 

I have encountered a major annoyance when Editor is started via Windows Start menu and when Editor started by my application.  When Editor is started by my application, and I instruct it to open a document, the View -> No Tags option is enabled.  But if Editor was initially started via Windows Start, documents are opened with View -> Full Tags enabled.  If I manually change a No-Tags window to Full-Tags, any subsequent document my application opens is showing Full Tags.

 

I am at a loss on why this happens.  Is there some Editor voodoo that occurs when it is started from Windows Start vs from another application.  When my application starts Editor, I give it no additional start parameters, just vanilla editor.exe.

 

One thing I have observed that may be triggering factor to the problem: When my application starts Editor then sends command to open a document, the default blank document window never pops up, where there appears to be an invalid window object that never gets realized (observation made in the discussion of a separate post).

 

Any insights will be greatly appreciated.

ACCEPTED SOLUTION

Accepted Solutions

I do not have permission to share all the code involved, but the setup is basically the following:

Using ACL and Java installed under Arbortext-path/custom, when Arbortext starts, a Java watcher service is created to receive command via the file system by an external program.  The problem described in the OP occurs when the service receives a command and opens up an edit window before Editor has opened up the initial blank window.  If Editor has the chance to open the initial blank window and then the command is received, no problem is observed.  I deduce from this is that Editor may have race conditions when it is first starting up as the "no tag" problem is not the only strangeness I have observed in my development efforts.  I could not find anything in the ACL documentation the provides a "post initialization" hook for custom code to know when Editor has completed its initialization process.

 

Solution/Workaround: What I ended up doing is registering a windows create hook via window_add_callback(), and defer the initialization of the Java watcher service until the hook is called with the first 'edit' window.  I also put a slight startup delay in the watcher server to help ensure Editor is done with whatever before invoking any commands.  The following illustrates the basic logic implemented:

global first_time = 1;
function _window_create_hook(win) {
  if (window_state(win) < 0) {
    return 0;
  }
  if (window_class(win) != "edit") {
    return 0;
  }
  if (first_time == 1) {
    first_time = 0;
    # ...Perform watch service initialization here...
  }
}
window_add_callback(0,'create','_window_create_hook');

View solution in original post

2 REPLIES 2

Hello @ehood,

 

Thank you for using PTC Community.

Thank you for reaching out with your question! It seems that your inquiry hasn't received any responses yet. To assist you better, I suggest providing more details and context. You might consider including:

"Could you share how your application is launching Arbortext Editor—are you using a specific API, scripting interface, or system call? Also, are there any startup scripts (like init.acl) or environment variables that might be influencing the initial view settings when Editor is launched externally?"

 

  • Clarify the launch mechanism.
  • Surface any customizations or environmental differences.
  • Identify whether the issue might be tied to Editor’s initialization process.

You might also find it useful to refer to the guide on how to ask a good question. This will enhance the likelihood of receiving valuable assistance from other Community members.
I'm also responding to bring attention to your question. Hopefully, another community member will be able to assist you soon.

Best Regards,
Vivek N
Community Moderation Team.

 

I do not have permission to share all the code involved, but the setup is basically the following:

Using ACL and Java installed under Arbortext-path/custom, when Arbortext starts, a Java watcher service is created to receive command via the file system by an external program.  The problem described in the OP occurs when the service receives a command and opens up an edit window before Editor has opened up the initial blank window.  If Editor has the chance to open the initial blank window and then the command is received, no problem is observed.  I deduce from this is that Editor may have race conditions when it is first starting up as the "no tag" problem is not the only strangeness I have observed in my development efforts.  I could not find anything in the ACL documentation the provides a "post initialization" hook for custom code to know when Editor has completed its initialization process.

 

Solution/Workaround: What I ended up doing is registering a windows create hook via window_add_callback(), and defer the initialization of the Java watcher service until the hook is called with the first 'edit' window.  I also put a slight startup delay in the watcher server to help ensure Editor is done with whatever before invoking any commands.  The following illustrates the basic logic implemented:

global first_time = 1;
function _window_create_hook(win) {
  if (window_state(win) < 0) {
    return 0;
  }
  if (window_class(win) != "edit") {
    return 0;
  }
  if (first_time == 1) {
    first_time = 0;
    # ...Perform watch service initialization here...
  }
}
window_add_callback(0,'create','_window_create_hook');
Announcements


Top Tags