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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Is it possible to move the cursor without repositioning the screen?

Yimeng
1-Newbie

Is it possible to move the cursor without repositioning the screen?

Hi there,

I'm using Arbortext Editor 8.0. According to the documentation at https://support.ptc.com/help/arbortext/r8.0.0.0/en/Program/acl_ref/help2141.html#, "goto_oid does not reposition the screen when moving the cursor". But in reality it does reposition the screen. For example, if I use goto_oid(oid_last()), it scrolls to the bottom. Is the documentation inaccurate? Is there a way to move the cursor without repositioning the screen?

Thanks!

1 REPLY 1

It looks like you're right, goto_oid() does seem to scroll the target oid into view when called.

 

If you want to do some operation on another part of the document without the user seeing the cursor jump around, you might be able to use doc_update_display() to temporarily stop screen updates while your script is busy. As long as your script doesn't take too long to run, it should be OK. You could try something like this:

 

function remoteOperation(targetoid) {
  # store current position
  local oid = oid_caret();
  local pos = oid_caret_pos();
  # disable screen updates
  doc_update_display(current_doc(),0);
  # go to target location and do whatever we need to do
  goto_oid(targetoid);
  do_some_stuff();
  # return to original caret location
  goto_oid(oid, pos);
  # reactivate screen updates
  doc_update_display(current_doc(),1);
}

 

Top Tags