NISUS Archives

January 2011

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Wed, 5 Jan 2011 22:23:07 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (52 lines)
Hello Nobumi,


On 2011-01-05 +0900 (JST), at 8:40 PM, Nobumi Iyanaga wrote:

> On Jan 5, 2011, at 3:01 AM, Kino wrote:
> 
>> Then, perhaps it might be helpful to know that, while Document object, Text object and TextSelection object are essential for NWP macro language (if we speak about manipulating text objects only, ignoring Image object for example), Range.object and Character Index are something secondary and made available just for convenience, I guess. For example and roughly speaking, 'TextSelection.setActiveRange $range' can be regarded as a kind of shorthand, equivalent to...
>> 
>> 	$doc = Document.active
>> 	$text = TextSelection.activeText
>> 	$sel = TextSelection.new $text, $range
>> 	$doc.setSelection $sel
>> 
> 
> Sorry, I am unable to understand this. What is the value of "$range"...?

The same as that of 'TextSelection.setActiveRange $range'.

> And anyway, both "TextSelection.setActiveRange" and "TextSelection.new" require range object, don't they...?

Um... you seem to understand just the opposite of what I (intended to) mean:

1. NW Classic macro does not have the concepts of Text object and TextSelection object tied to it, which are basic elements of NWP macro.

2. As far as operations related to a document are concerned, TextSelection object (i.e. Text object + Range object ) is more fundamental than Range object.

3. There are several commands for operations on a document (window), which do not require Text object, e.g. 'TextSelection.setActiveRange $range'.

4. However, in my understanding, they are a kind of shorthands of TextSelection object commands. For example, that 'TextSelection.setActiveRange $range' command can be understood as a shorthand of

	$doc = Document.active
	$text = TextSelection.activeText
	$sel = TextSelection.new $text, $range
	$doc.setSelection $sel


Am I clear enough?

[...]
 
>> And a yet another version of insert paragraph number macro.

> This is also a very clever macro. But it does use a range object, doesn't it...?

Err... that macro is not directly related to what I wrote above. I just wanted to add another sample macro doing basically the same thing. Also I thouhgt it might be helpful for someone on the list to know 'rangeOfParagraphAtIndex' command does not work properly for a Text object having a table.

And the range object in the macro is just a value got by a Text object command (rangeOfParagraphAtIndex) and used as an argument by another Text object command (insertAtIndex).


Kino

ATOM RSS1 RSS2