| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Yes! Perfect! That's it!
Thanks, Philip!
--Gil
As you have discovered, the font you set in Interface Builder doesn't stick. You can, however, set the font in your code. You need to use a "call method". Add this line to your code:
set its font to call method "fontWithName:size:" of class "NSFont" with parameters {"Courier", 14}
So your code looks like this:
tell text view 1 of scroll view 1 of window "Lyrics"
set its font to call method "fontWithName:size:" of class "NSFont" with parameters {"Courier", 14}
set its contents to myString
end tell
The font and font size that you want for the text view is set in the parameters of that line ... {"Courier", 14}. If you wanted a font style other than regular, e.g. if you wanted the text in the text view displayed in Times Italic, 18 point, then the parameters would be ... {"Times-Italic", 18}
Hope that helps
Philip
On Sun 11/05/08 6:05 AM , Gil Dawson email@hidden sent:As my first AS project, I have managed to create a little window with
a few buttons and a text view that displays the contents of myString
when my program executes the following code:
tell text view 1 of scroll view 1 of window "Lyrics"
set its contents to myString
end tell
I would like to display this string in a monospaced font, like Monaco
or Courier, for example. Any ideas on how to do this?
I tried...
in Interface Builder, I...
selected the Text View
(or the Scroll View; it doesn't seem to make any difference)
pulled down from Format to Font to "Show Fonts"
in the Font floating window that appeared,
selected "Fixed Width" Courier" "Regular" "12"
(Here I wasn't sure what to do so I...)
closed the Font floating window
Then I clicked "Build and Go" and "Save All". In a few seconds, my
app launched and myString appeared in the window, but still in the
same old proportional font.
Any suggestions?
--Gil---- Message sent via KC WebMail - http://webmail.mistral.net/ _______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Studio mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-studio/email@hidden
This email sent to email@hidden
_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Studio mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-studio/email@hidden
| References: | |
| >Re: Control the font in a text view (From: Philip Buckley <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.