I have a “credits.html” file that gets used automagically for my app’s about box. But if I put a lengthy bit of text/web html in there, when the about box is opened it seems to be scrolled to the bottom of the view all the time. Is there some way to make it stay at the top? Does anyone else even see or have this issue?
I’ve tried both a Credits.html file and a Credits.rtf file, and the about panel that comes up is not scrolled to the bottom in either case for me (I’m using Xcode 3 under Lion).
Ric
That sounds like an issue with the html.
While I was experimenting with the subject of this post, I noticed that there is no direct way to access the standard about panel – there is a method to show it, but no method to return the panel if you need to modify it in any way. Of course, you could make your own and hook it up to the “about” menu item, but the code below, FWIW, shows how to access it, and how to get access to all the subviews it contains with a neat little recursive method that I found on the internet and translated from Objective-C. This code, as an example, changes the appearance of the text view that you get if you have a lot of text in your about panel. I unhooked the default method from the “about” menu item and hooked up my method, openAboutPanel, instead:
on openAboutPanel_(sender)
current application's NSApp's orderFrontStandardAboutPanel_(me)
set aboutPanel to current application's NSApp's keyWindow()
set allSubviews to allSubviewsOfView_(aboutPanel's contentView())
log allSubviews
set pred1 to current application's NSPredicate's predicateWithFormat_("self.class == %@", current application's NSScrollView)
set pred2 to current application's NSPredicate's predicateWithFormat_("self.class == %@", current application's NSTextView)
set theScrollView to allSubviews's filteredArrayUsingPredicate_(pred1)'s lastObject()
set tv to allSubviews's filteredArrayUsingPredicate_(pred2)'s lastObject()
theScrollView's setDrawsBackground_(0)
theScrollView's setBorderType_(0)
tv's setDrawsBackground_(0)
end openAboutPanel_
on allSubviewsOfView_(parentView) -- A recursive function to get all subviews (and their subviews, etc.) of a given view
set theSubviews to parentView's subviews()
repeat with aSubview in theSubviews
theSubviews's addObjectsFromArray_(allSubviewsOfView_(aSubview))
end repeat
return theSubviews
end allSubviewsOfView_
Ric
yeah the HTML had some little issues, but with what I there, I still had to make some illegal code to make it work right, or maybe it was just not formatted the way I wanted it. I think a
needed to be closed
but without putting anotherafter that did something to scroll it down. HTML, ugh. :mad: