set offset always at the same position
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 99
- Joined: Fri Jul 01, 2022 12:08 pm
set offset always at the same position
Post by shikhar_472 »
Hi Team,
i want to set the cursor always at the same position doesnt matter how many words or extra things got added in between the operation and where cursor has been moved but after giving the pop up of complete operation i want to set it back to the same position where i started.
tried using getting getcaretoffset and setting the same but cursor is moving here and there because words got added in between of the operation so caret information has been changed.
Thanks,
Shikhar.
i want to set the cursor always at the same position doesnt matter how many words or extra things got added in between the operation and where cursor has been moved but after giving the pop up of complete operation i want to set it back to the same position where i started.
tried using getting getcaretoffset and setting the same but cursor is moving here and there because words got added in between of the operation so caret information has been changed.
Thanks,
Shikhar.
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: set offset always at the same position
Hello,
Please give us more details about your use case, like:
- What product do you use: Oxygen XML Editor or Oxygen Web Author?
- What operation do you use? It is a custom AuthorOperation?
- Can you share the code that you tried?
Best Regards,
Mihaela
Please give us more details about your use case, like:
- What product do you use: Oxygen XML Editor or Oxygen Web Author?
- What operation do you use? It is a custom AuthorOperation?
- Can you share the code that you tried?
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 99
- Joined: Fri Jul 01, 2022 12:08 pm
Re: set offset always at the same position
Post by shikhar_472 »
Hi Mihela,
I am using oxygen web author,
case "start":
startOffset = docModel.getAuthorAccess().getEditorAccess().getCaretOffset();
break;
case "complete":
docModel.getAuthorAccess().getEditorAccess().setCaretPosition(startOffset);
break;
default:
logger.info("invalid actionType== " + actionType);
break;
}
i am using this code for spell check operation and after the spell check complete we want the cursor to set at where it got started.
so at start of the operation i am collecting the info about startoffset and when spellcheck is done for the whole doc we are setting the offset to this position as while running the spellcheck few words got added and offset became change for the position where i started so cursor is getting set to different locaion.
Thanks.
Thanks,
Shikhar.
I am using oxygen web author,
case "start":
startOffset = docModel.getAuthorAccess().getEditorAccess().getCaretOffset();
break;
case "complete":
docModel.getAuthorAccess().getEditorAccess().setCaretPosition(startOffset);
break;
default:
logger.info("invalid actionType== " + actionType);
break;
}
i am using this code for spell check operation and after the spell check complete we want the cursor to set at where it got started.
so at start of the operation i am collecting the info about startoffset and when spellcheck is done for the whole doc we are setting the offset to this position as while running the spellcheck few words got added and offset became change for the position where i started so cursor is getting set to different locaion.
Thanks.
Thanks,
Shikhar.
-
- Posts: 99
- Joined: Fri Jul 01, 2022 12:08 pm
Re: set offset always at the same position
Post by shikhar_472 »
Hi Team,
Is there any update on this.
Thanks,
Shikhar.
Is there any update on this.
Thanks,
Shikhar.
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: set offset always at the same position
Hello,
What you can do is to create a position in the document before invoking the operation, using the ro.sync.ecss.extensions.api.AuthorDocumentController.createPositionInContent(int) API and then restore this position setting the caret to position.getOffset().
Best Regards,
Mihaela
What you can do is to create a position in the document before invoking the operation, using the ro.sync.ecss.extensions.api.AuthorDocumentController.createPositionInContent(int) API and then restore this position setting the caret to position.getOffset().
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service