• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Setting the Vertical Scroller to the bottom
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the Vertical Scroller to the bottom


  • Subject: Setting the Vertical Scroller to the bottom
  • From: Richard Covert <email@hidden>
  • Date: Sat, 29 May 2004 16:46:41 -0500

I have an AS Studio app which has a Text View enclosed by a scroller.

They are named as such:

the text view "statusTextView" of scroll view "statusScrollView" of
window "main"


How do I set the scroller to the bottom of the text view after I write
to the text view?
I get an Applescript error such as :
NSReceiversCantHandleCommandScriptError(4)
when I try to move the vertical scrollbar.


I do a write by this handler which is part of a script object:

The problem is that as I copy new messages to the text view object the
vertical scollbar on the right moves up. So, the user has to
manually move the scroll bar down to see new messages.
How do I add messages to the text view so that you appear AFTER
previous messages (i.e. they are appended to
existing messages) and are still visible to the user without forcing
the user to move the scroll bar?


The commented out lines fail.

to updateText to message

tell window "main"
copy the contents of text field "statusField" to oldMessage -- an
older text field that I want to
copy oldMessage & return & message to newMessage -- replace
with a scrollable text view
set the contents of text field "statusField" to newMessage
copy the newMessage to the contents of the text view
"statusTextView" of scroll view "statusScrollView"
set hasVerticalScroller to has vertical scroller of scroll view
"statusScrollView"
if hasVerticalScroller is true then
display dialog "the scroller has a verical scrollbar now"
-- tell text view "statusTextView" of scroll view "statusScrollView"
to scroll to the bottom

else
display dialog "the scroller DOES NOT has a verical scrollbar now"
end if

-- copy the message to the end of the contents of the text view
"statusTextView" of scroll view "statusScrollView"
-- set the vertical scroller of the text view "statusTextView" of
scroll view "statusScrollView" to the bottom
-- scroll the text view "statusTextView" of the scroll view
"statusScrollView" to the bottom
-- scroll to the bottom of the scroll view "statusScrollView"
update
end tell
end updateText
_______________________________________________
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.


  • Follow-Ups:
    • Re: Setting the Vertical Scroller to the bottom
      • From: Joseph Weaks <email@hidden>
  • Prev by Date: Re: Catching Eject Errors
  • Next by Date: Re: Setting the Vertical Scroller to the bottom
  • Previous by thread: Re: How to select the current person in address book
  • Next by thread: Re: Setting the Vertical Scroller to the bottom
  • Index(es):
    • Date
    • Thread