PSetTextCursor

Selects text from the specified location to the ending location, turning the page as appropriate. If the ending location is the same as the beginning loca tion, the cursor moves to that location without selecting any text.


Command constructor

PSetTextCursor(unsigned long nStoryID, long nBegin, long nEnd);
unsigned long nStoryID;
Identifier for story (value ignored if in story editor)
kParmDontCare to select text in story currently containing the insertion point
long nBegin;
Starting location for text selection, in characters from beginning of story (0 sets insertion point prior to first character in story)
long nEnd;
Ending location of text selection, in characters from beginning of story (if nBegin equals nEnd, the cursor remains in that location)
Count of non-printing characters. Include inline graphics and non-printing characters (such as index markers, tabs, and returns) in nBegin and nEnd.

Getting the story ID. To get the identifier for the story (as a value for nStoryID), use the PGetTextRun, PGetTextCursor, or PGetStoryIDList queries.

Story editor. When in story editor, PageMaker ignores nStoryID and selects text in the current story, scrolling the screen as necessary.

Unplaced text. When layout view is active, PageMaker displays an error message if the values for nBegin or nEnd would position the insertion point in unplaced text i.e., (text in a story that has not been placed on the page or pasteboard).

Selection direction irrelevant. The PSetTextCursor command does not record the direction in which you select text. The end of the selection is always the last (right-most) character. For example, PageMaker selects the same characters using either of the following lines:

PSetTextCursor(-2, 3, 7); PTextSelect(kTextAmtCharFor);

PSetTextCursor(-2, 7, 3); PTextSelect(kTextAmtCharFor);

Warning. Use the PTextCursor command, not PSetTextCursor, to move the cursor to the end of a story. If the PSetTextCursor parameters nBegin and nEnd are both equal to the number of characters in the story, PageMaker returns an error and removes the insertion point from the story.

Value out of range. If nEnd exceeds the number of characters in the story, PageMaker selects text from nBegin to the end of the story. If nBegin exceeds the number of characters in the story, PageMaker selects text from the end of the story back to nEnd. If both nEnd and nBegin are in overset text, the command fails.

Example. The following example selects the characters between the fifth and tenth characters in the story with the PageMaker ID "3".

PSetTextCursor(3, 5, 10);


See also

The PNewStory, PTextCursor, and PTextEdit commands

The PGetTextLocation, PGetTextRun, PGetTextCursor, and PGetStoryIDList queries


Copyright © 1996, Adobe Systems Incorporated. All rights reserved.

Comments or suggestions? Contact Adobe Developer Support