General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Move cursor inside node from selection
-
MrPaul March 18, 2013 at 8:31 pm
Move cursor inside node from selection
March 18, 2013 at 8:31 pmParticipants 1Replies 2Last Activity 9 years, 10 months agoConsider the following XML:
sedan If the selection is currently on the entirety of element:
sedan How do I move the cursor directly after the
[s]element[/s] tag? Note: Selection.ContainerNode is
. I want the ContainerNode to be . I am using XMAX v6. Derek Read March 19, 2013 at 3:48 am
Reply to: Move cursor inside node from selection
March 19, 2013 at 3:48 amThere would be quite a few ways to do this. Here are a couple of the simplest. You might need additional code if your selection is not always guaranteed to be as you have described it.
Assuming you meant “directly after the
tag” (not “element”, which would put it after the tag) this should do it:
Selection.Collapse(sqCollapseStart);
Selection.MoveRight();This would result in the same selection:
Selection.Collapse(sqCollapseStart);
Selection.MoveToElement("car");As would this:
Selection.Collapse(sqCollapseStart);
Selection.MoveToElement("");And so would this:
Selection.MoveToDocumentStart();
Selection.MoveToElement("car"); -
AuthorPosts
- You must be logged in to reply to this topic.