Re: How to use replaceCharactersInRange
Re: How to use replaceCharactersInRange
- Subject: Re: How to use replaceCharactersInRange
- From: Romain Brestac <email@hidden>
- Date: Sun, 20 Apr 2003 20:05:55 +0200
I'm not positive, but if I had to guess
You never "have" to ...
, I'd say your problem is that you're
setting thRange to a list in AppleScript. Upon bridging to Cocoa,
lists are
typed as NSArrays, not NSRanges. As a result, you're feeding it a bad
argument.
As far as i've seen, the bridge works with Cocoa objects, but
NSRange's are
simple C structures. How to create and manipulate one is unclear.
Don't manipulate them, just use them. It works.
John
John, I saw you sent your answer only 2 minutes after mine, so you are
not "totally" responsible of non-checking.
I don't know why and how NSRange and C-structures can be automatically
created from an AS list but something I know is that people at Apple
working on Cocoa, ASS and AS are just genius. This is the basis.
And even if they don't answer my questions (cf
<
http://lists.apple.com/archives/applescript-studio/2003/Apr/18/
ondatarepresentation.txt> and <
http://lists.apple.com/archives/applescript-studio/2003/Mar/11/
arrowsintableviews.txt>) I can't blame them because I know they have no
time because they are working on the next genial OS which will allow
even automatic bridges between NSApples and NSBananas. :=)
Have a good day,
Romain
Hi,
I have no problems to get and set the selection in a text view
using method
calls but I failed with "replaceCharactersInRange:"
In the following lines I tried it with object (tv), object (txt)and
object
(ct), all with no success.
set tv to text view "tv" of scroll view "tv" of window "main"
set txt to text of tv
set ct to contents of tv
set thRange to {1, 3}
call method "replaceCharactersInRange:" of object (tv) with
parameters
{thRange, "ABC"}
What I'm doing wrong?
Thanks for your help.
Peter
_________________________________________
Victory attained by violence is tantamount to a defeat, for it is
momentary.
Mahatma Gandhi (1869 - 1948), May 3, 1919
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.