Brian, I built a small sample app that just has a TextView in it, with associated ScrollView. Here's code that shows how to do the translation, and it seems to work fine in this simple app:
property theScrollView : missing value property theTextView : missing value
....
on applicationDidFinishLaunching_(aNotification)
repeat with i from 1 to 40 tell theTextView to insertText_("This is some new text..." & return) end
-- NSPoint currentScrollPosition=[[theScrollView contentView] bounds].origin;
set currentScrollPosition to the theScrollView's contentView()'s |bounds|()'s |origin|()
-- [[theScrollView documentView] scrollPoint:currentScrollPosition];
tell theTextView to scrollPoint_({0,0}) -- scrolls to the top (for testing next line)
tell theTextView to scrollPoint_(currentScrollPosition) -- scrolls to the bottom
end applicationWillFinishLaunching_
On 2 Oct 2014, at 10:43 PM, No problem, Brian. I'll muddle through this a bit more tomorrow and get back to you. I agree, ASObjC is a pain. That's why I do all my work in straight Objective C, where I have a real compiler and debugger to assist me.
On 2 Oct 2014, at 10:40 PM, G'day Ron
Thanks for your concrete example. Unfortunately it still generates the same error. However, your code is completely different from what I expected the correct code to be, so food for thought.
I'm going to have to try and follow Shane's advice once again, but unfortunately when Shane uses terms like 'clue' and 'pretty obvious' he's speaking from someone who has this damn stuff running through his veins, whereas to me, those terms mean I'm once again going to have to group my way through a bloody blinding snow storm, usually without success.
It's no wonder that it seems very few people actually take up programming in ASObjC, there's so many hurdles! And so very, very few concrete examples of conversion.
Regards
Santa
On 03/10/2014, at 12:04 PM, Ron Reuter Right, you'll have to use contentView() because it is a method on a view, not a property of a view.
On 2 Oct 2014, at 9:01 PM, Ron Reuter Brian, I program in Objective C, and its been awhile since I tried ASOC, but the translation should be something like this:
NSPoint currentScrollPosition=[[theScrollView contentView] bounds].origin;
set currentScrollPosition to the origin of the bounds of the contentView of theNewColorsView
[[theScrollView documentView] scrollPoint:currentScrollPosition];
set the scrollPoint of the documentView of theNewColorView to currentScrollPosition
• Ron
_______________________________________________ Do not post admin requests to the list. They will be ignored. applescriptobjc-dev mailing list ( email@hidden) |