Getting color attribute from NSFontPanel/NSFontManager
Getting color attribute from NSFontPanel/NSFontManager
- Subject: Getting color attribute from NSFontPanel/NSFontManager
- From: Vinay Prabhu <email@hidden>
- Date: Tue, 12 Dec 2006 20:22:57 +0530
- Importance: Normal
Hi,
I am trying to launch the Font Panel, when user clicks on the button in the
window.
The requirement is such that I can not use the Font Menu for launching the
Font Panel.
The code,
[[NSFontManager sharedFontManager] setAction:@selector(changeFont:)];
[[NSFontManager sharedFontManager] orderFrontFontPanel:self];
When new font is selected or any font attributes are changed (color
attribute) in the Font Panel, "changeFont" action is not called.
So to obtain the changes made in Font Panel, I have used following method.
1) I have registered the controller class to receive the
NSWindowWillCloseNotification for NSFontPanel shared object.
So that when Font Panel is closed, controller class will receive a
notification.
2) In the windowWillClose method, I am trying to get the new font from Font
Panel.
NSFont* newFont = [[NSFontPanel sharedFontPanel] panelConvertFont:oldFont];
The newFont object will have all the new attributes like Font Family, Font
Style, Font Size etc, except for the Foreground Color, Text Underline and
Text StrikeThrough set
in the Font Panel.
Is there anyway to obtain Foreground Color, Text Underline and Text
StrikeThrough attributes from Font Panel?
Regards
Vinay
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden