AppleScript-ObjC Bridge Problem

2015-11-11 Thread Dave
Hi,

I’m using the AppleScript-ObjC Bridge to call an AppleScript from an XCode 
Objective-C project. This is the handler I am calling:

on 
getOutlookMessagePropertiesDictionaryWithMessageID:(theMessageIDString)
set myDictionary to the pMessageDictionary of me
set myMessageID to theMessageIDString as number

—
—  Statements commented out for debugging
--

return myDictionary
end getOutlookMessagePropertiesDictionaryWithMessageID:

This is giving an error on the:

set myMessageID to theMessageIDString as number

I tried calling the handler from an AppleScript in the Script Editor and it 
runs ok, but it fails in the App. If I comment this line out, it runs ok.

Any ideas on what could be causing it fail? I am passing an NSString into the 
method and it definitely numeric at the log shows:

Printing description of theMessageIDString:
540

Thanks a lot
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

AppleScript-ObjC Bridge Problem

2015-11-11 Thread Dave
I tried adding the following:

try
set myMessageID to theMessageIDString as number

on error errorMessage number errorNumber
say errorNumber
say errorMessage
return 
"getOutlookMessagePropertiesDictionaryWithMessageID  - Error Message ID: " & 
theMessageIDString
end try

But I don’t get an error? Really confused as it what is going on with this 
seemingly simple Script and not sure how to debug it, any help greatly 
appreciated.

All the Best
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.11: NSDatePicker cuts off year digit

2015-11-11 Thread Markus Spoettl

On 10/11/15 18:26, Markus Spoettl wrote:

This happens on 10.11 only, not on 10.10. Anyone able to confirm this using own
code? Maybe something is set up incorrectly? Anyone know of a workaround until
this gets fixed (yes, I will file a bug once it's confirmed that it's not my
fault).


Thanks Norbert for the confirmation.

I tried a couple of things to get around the problem, but there seems to be no 
good solution.


The only workaround I could come up with it setting the font that the picker 
uses to something other than "System" or "Lucida Grande". In both these cases, 
the font is replaced with the wider system font on 10.11. The downside of course 
is that "Helvetica Neue", which I now have to use for these controls, looks a 
little different.


My theory is that the system does a measurement to size the date cells it uses 
internally before it replaces the font... It happens on regular size controls 
too and also on controls with time. No one ever tested this.


Regards
Markus
--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

More AppleScript-ObjC Bridge Weirdness

2015-11-11 Thread Dave
Hi,

I restarted my Mac and and added as string on the handler definition and  it 
started working (not sure which of these helped):

on getOutlookMessagePropertiesDictionaryWithMessageID:(theMessageIDString as 
string)

say "getOutlookMessagePropertiesDictionaryWithMessageID"
--say "theMessageIDString: " & theMessageIDString

set myDictionary to the pMessageDictionary of me

set myMessageID to theMessageIDString as number
--say "myMessageID: " & myMessageID

tell application "Microsoft Outlook"
set myMessage to (get message id myMessageID)

set kMessageID of myDictionary to (the id of myMessage 
as string)
set kMessageClass of myDictionary to (the class of 
myMessage as string)

end tell

return myDictionary

end getOutlookMessagePropertiesDictionaryWithMessageID:
end script

But now I have another problem with types/classes on the:

set kMessageID of myDictionary to (the id of myMessage 
as string)
set kMessageClass of myDictionary to (the class of 
myMessage as string)

When I look at the returned dictionary I see:

kMessageClass = "\U00abclass outm\U00bb";
kMessageID = 540;

Which are not of type NSString which is what I expected. However, if I run the 
script in the Script Editor I get the String Equivalents:

kMessageID:"540”, 
kMessageClass:"outgoing message"

Is this possible using the AppleScript-ObjC Bridge? I can’t find any real 
documentation on this and I’m not sure of what is going on. If someone could 
point at some documentation of how to do this kind of thing, I’d be so grateful!

I was using the Scripting Bridge to do this and all this was easy, but I 
couldn’t figure out how to add and remove objects, I started using 
AppleScript-ObjC Bridge because someone told me it was broken and the 
AppleScript-ObjC Bridge was the only method that worked. Really not sure what 
to do now…..

Cheers
Dave



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Set editable string into NSTextFieldCell

2015-11-11 Thread Raglan T. Tiger

In my cell based NSOutlineView subclass I implement -mouseDown where I check 
for double-click. I am able to set a placeholder string.

How does one set the NSText object with a string value that can be edited?


-rags




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Set editable string into NSTextFieldCell

2015-11-11 Thread Graham Cox

> On 12 Nov 2015, at 7:19 AM, Raglan T. Tiger  wrote:
> 
> n my cell based NSOutlineView subclass I implement -mouseDown where I check 
> for double-click. I am able to set a placeholder string.
> 
> How does one set the NSText object with a string value that can be edited?


You don’t need to subclass NSOutlineView here. Double-clicks are already 
detected and trigger the -doubleAction: be sent to the target of the control. 
This is usually sufficient. If you leave everything standard, then editing text 
cells should ‘just work’ as long as you set the necessary flags to allow 
editing, and implement the dataSource methods that update the model for the 
edited property.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: More AppleScript-ObjC Bridge Weirdness

2015-11-11 Thread Shane Stanley
On 12 Nov 2015, at 4:29 AM, Dave  wrote:
> 
> I restarted my Mac and and added as string on the handler definition and  it 
> started working (not sure which of these helped):

The "as string" did it. Passing from Objective-C to AppleScript uses lazy 
conversion; it doesn't happen unless you ask for it.
> 
> But now I have another problem with types/classes on the:
> 
>   set kMessageID of myDictionary to (the id of myMessage 
> as string)
>   set kMessageClass of myDictionary to (the class of 
> myMessage as string)
> 
> When I look at the returned dictionary I see:
> 
>kMessageClass = "\U00abclass outm\U00bb";
>kMessageID = 540;
> 
> Which are not of type NSString which is what I expected. However, if I run 
> the script in the Script Editor I get the String Equivalents:
> 
> kMessageID:"540”, 
> kMessageClass:"outgoing message"

You're expecting roughly the equivalent of an enum being returned as a string 
rather than an int in Objective-C, or a constant necessarily matching what it 
represents. Script Editor has the dictionary loaded so it can do the 
conversion, but a running app doesn't, so it converts the underlying code as 
best it can.

You need to test the options and build your own string:

if class of myMessage is outgoing message then
set kMessageClass of myDictionary to "outgoing message"
...

-- 
Shane Stanley 



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Set editable string into NSTextFieldCell

2015-11-11 Thread Raglan T. Tiger
> On Nov 11, 2015, at 2:38 PM, Graham Cox  wrote:
> 
> You don’t need to subclass NSOutlineView here. Double-clicks are already 
> detected and trigger the -doubleAction: be sent to the target of the control. 
> This is usually sufficient. If you leave everything standard, then editing 
> text cells should ‘just work’ as long as you set the necessary flags to allow 
> editing, and implement the dataSource methods that update the model for the 
> edited property.

I have a subclass for reasons other than what is being discussed here.  My 
issue is, if I do nothing then, when the user double-clicks an item in the 
outline a text field is displayed and the user can enter a new string, press 
enter and all works well.  My model is updated etc, etc. 

How do I put the current string from the item into the edit field ?

I can put a placeholder string there but this is not an editable value.

-rags

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Set editable string into NSTextFieldCell

2015-11-11 Thread Graham Cox

> On 12 Nov 2015, at 9:52 AM, Raglan T. Tiger  wrote:
> 
> How do I put the current string from the item into the edit field ?
> 

If you have implemented the dataSource protocol, the value of the text field 
should be already set. When you start editing, that value is automatically 
copied into the editor, you don’t have to do anything.

If it’s not working, you might have done something elsewhere that is preventing 
it working as it should.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Detecting when a text view becomes First Responder

2015-11-11 Thread Graham Cox
I need to know when a text view becomes First Responder. I thought the 
notification NSTextDidBeginEditingNotification would do it, but that’s only 
sent when the user starts typing in the text view, which is too late for my 
purposes.

Is there another notification that I could use that signals a view has become 
FR? I couldn’t see anything either specific to NSTextView (or NSText) or 
views/responders in general. I’d prefer not to have to use a text view subclass 
if possible, though if that’s the only way so be it.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Detecting when a text view becomes First Responder

2015-11-11 Thread Dave Fernandes
The delegate method textFieldDidBeginEditing: is called before the user starts 
typing.

> On Nov 11, 2015, at 6:04 PM, Graham Cox  wrote:
> 
> I need to know when a text view becomes First Responder. I thought the 
> notification NSTextDidBeginEditingNotification would do it, but that’s only 
> sent when the user starts typing in the text view, which is too late for my 
> purposes.
> 
> Is there another notification that I could use that signals a view has become 
> FR? I couldn’t see anything either specific to NSTextView (or NSText) or 
> views/responders in general. I’d prefer not to have to use a text view 
> subclass if possible, though if that’s the only way so be it.
> 
> —Graham
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please 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:
> https://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca
> 
> This email sent to dave.fernan...@utoronto.ca


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Detecting when a text view becomes First Responder

2015-11-11 Thread Ken Thomases
On Nov 11, 2015, at 5:04 PM, Graham Cox  wrote:
> 
> I need to know when a text view becomes First Responder. I thought the 
> notification NSTextDidBeginEditingNotification would do it, but that’s only 
> sent when the user starts typing in the text view, which is too late for my 
> purposes.
> 
> Is there another notification that I could use that signals a view has become 
> FR? I couldn’t see anything either specific to NSTextView (or NSText) or 
> views/responders in general. I’d prefer not to have to use a text view 
> subclass if possible, though if that’s the only way so be it.

You can either use a subclass of NSTextView and override its 
-becomeFirstResponder method or you can use KVO to observe the firstResponder 
property of the window and, each time it changes, check if it's your text view.

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Detecting when a text view becomes First Responder

2015-11-11 Thread Graham Cox

> On 12 Nov 2015, at 10:12 AM, Dave Fernandes  
> wrote:
> 
> textFieldDidBeginEditing


Sounds promising, but I can’t find that anywhere in the documentation. Where is 
it defined? (n.b. I should make clear this is on Mac OS, if that’s iOS only I 
can’t use it).

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Detecting when a text view becomes First Responder

2015-11-11 Thread Graham Cox

> On 12 Nov 2015, at 10:14 AM, Ken Thomases  wrote:
> 
> You can either use a subclass of NSTextView and override its 
> -becomeFirstResponder method or you can use KVO to observe the firstResponder 
> property of the window and, each time it changes, check if it's your text 
> view.


Thanks - I suspected it might be another subclass case. The KVO idea sounds 
feasible as well, I’ll look into that.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Detecting when a text view becomes First Responder

2015-11-11 Thread Dave Fernandes
Doh! It’s iOS. Wasn’t paying attention.

> On Nov 11, 2015, at 6:16 PM, Graham Cox  wrote:
> 
> 
>> On 12 Nov 2015, at 10:12 AM, Dave Fernandes  
>> wrote:
>> 
>> textFieldDidBeginEditing
> 
> 
> Sounds promising, but I can’t find that anywhere in the documentation. Where 
> is it defined? (n.b. I should make clear this is on Mac OS, if that’s iOS 
> only I can’t use it).
> 
> —Graham
> 
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Stack View Question

2015-11-11 Thread Michael de Haan 
I am designing an interface in Swift, Xcode 7.2 which uses Stack views to 
surround an Image view; ( It’s a compass rose and the surrounding buttons are 
the Cardinal, InterCardinal and secondary-intercardinal directions)

It looks something like this.



[(Button1) (Button2) ……… (Button5)  ]   <---(Horizontal stack view)

Vertical Stack View below.
 
[(Button1)
.
.
.
.(Button3) ]



The bottom and right sides are mirror images of this, with the image view 
placed in a horizontal stack view, including the right vertical stack view.  
The UI itself looks good, with all the buttons remarkably well distributed 
around the image view.

The problem is this.

Because there are 5 buttons in the top and bottom rows, and 3 in the vertical 
left and right rows, the spacing in the vertical stack views are not as “tight” 
as I want it to be.

What I want is this. Lets call the space between the buttons “Empty Space"

[ Empty Space
Empty Space
Empty Space
Button1
Empty Space
Button2
Empty Space
Button3
Empty Space
Empty Space
Empty Space]

I tried the code below, and even though I think this on the right track , it 
has no effect, so I wonder if anyone has some insight into this.(It’s called in 
the vewController"s “ViewDidLoad” method.)
What I am trying to achieve, is to add a “spacer” (UILayoutGuide) between the 
upper( ?upper anchor) of the StackView and the first button, and in a mirrored 
fashion, between the lower button and the lower anchor of the stackView. And, 
hopefully, this will allow the Stackview’s “Equal Spacing" setting to produce 
what I want)


 func setupLayout(){
let space1 = UILayoutGuide()
let space2 = UILayoutGuide()

self.leftStackView.addLayoutGuide(space1)
self.leftStackView.addLayoutGuide(space2)


leftStackView.topAnchor.constraintEqualToAnchor(space1.topAnchor).active = true
space1.bottomAnchor.constraintEqualToAnchor(button1.topAnchor).active = 
true
space1.widthAnchor.constraintEqualToAnchor(space2.widthAnchor).active = 
true
space2.topAnchor.constraintEqualToAnchor(button3.bottomAnchor).active = 
true

space2.bottomAnchor.constraintEqualToAnchor(leftStackView.bottomAnchor).active 
= true
}

(buttonl1 and button2 are outlets, as is “leftStackView")

Thanks.







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Stack View Question

2015-11-11 Thread Ken Thomases
On Nov 11, 2015, at 6:43 PM, Michael de Haan   wrote:
> 
> Because there are 5 buttons in the top and bottom rows, and 3 in the vertical 
> left and right rows, the spacing in the vertical stack views are not as 
> “tight” as I want it to be.
> 
> What I want is this. Lets call the space between the buttons “Empty Space"
> 
> [ Empty Space
> Empty Space
> Empty Space
> Button1
> Empty Space
> Button2
> Empty Space
> Button3
> Empty Space
> Empty Space
> Empty Space]

Why do you want the extra empty space inside stack view?  Why not just make the 
stack view shorter by putting external spacing?

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Stack View Question

2015-11-11 Thread mdeh


- Original Message -

From: "Ken Thomases"  
To: "Michael de Haan "  
Cc: "Cocoa Developers"  
Sent: Wednesday, November 11, 2015 4:59:51 PM 
Subject: Re: Stack View Question 

On Nov 11, 2015, at 6:43 PM, Michael de Haan   wrote: 
> 
> Because there are 5 buttons in the top and bottom rows, and 3 in the vertical 
> left and right rows, the spacing in the vertical stack views are not as 
> “tight” as I want it to be. 
> 
> What I want is this. Lets call the space between the buttons “Empty Space" 
> 
> [ Empty Space 
> Empty Space 
> Empty Space 
> Button1 
> Empty Space 
> Button2 
> Empty Space 
> Button3 
> Empty Space 
> Empty Space 
> Empty Space] 

Why do you want the extra empty space inside stack view? Why not just make the 
stack view shorter by putting external spacing? 


Hi Ken 
Well, I **though** :-) that would be a cleaner approach. All of the stack views 
are nested within one root view, so the root view is the only stack view 
requiring constraints. 
But, you might well be correct. 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Stack View Question

2015-11-11 Thread Michael de Haan 
Please accept my apologies for the addresses on the previous post. Comcast 
suddenly asked for a reset of passwords ( apparently someone tried to sell 
thousands of their customer passwords 3 days ago etc) , and I was using their 
webmail site.



> 
> On Nov 11, 2015, at 6:43 PM, Michael de Haan   > wrote: 
>> 
>> Because there are 5 buttons in the top and bottom rows, and 3 in the 
>> vertical left and right rows, the spacing in the vertical stack views are 
>> not as “tight” as I want it to be. 
>> 
>> What I want is this. Lets call the space between the buttons “Empty Space" 
>> 
>> [ Empty Space 
>> Empty Space 
>> Empty Space 
>> Button1 
>> Empty Space 
>> Button2 
>> Empty Space 
>> Button3 
>> Empty Space 
>> Empty Space 
>> Empty Space] 
> 
> Why do you want the extra empty space inside stack view? Why not just make 
> the stack view shorter by putting external spacing? 
> 
> 
> Hi Ken 
> Well, I **though** :-) that would be a cleaner approach. All of the stack 
> views are nested within one root view, so the root view is the only stack 
> view requiring constraints. 
> But, you might well be correct. 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> )
> 
> Please 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:
> https://lists.apple.com/mailman/options/cocoa-dev/mdeh%40comcast.net 
> 
> 
> This email sent to m...@comcast.net 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Customising NSFontManager

2015-11-11 Thread Graham Cox
According to the docs for NSFontManager:


+ setFontPanelFactory:
Sets the class used to create the Font panel to the given class.

Discussion
Invoke this method before accessing the Font panel in any way, such as in the 
application delegate’s applicationWillFinishLaunching: method.


I’m doing exactly this, as the very first line of 
-applicationWillFinishLaunching, but I get an error that the shared Font 
Manager instance already exists. Is there an earlier time I can use, or a 
better way to reliably set the FM factory class?

You might wonder why I need to do this. My app replaces the Font Panel with an 
interface of its own. In order to hook this interface in correctly for standard 
text views, I need to partially replace or supplement the standard font 
conversion mechanism which requires that a text object implements -changeFont:, 
and in turn invokes -convertFont: on the SENDER of the changeFont: message. 
Fine, except that NSTextView isn’t doing that - it’s invoking methods on 
[NSFontManager sharedFontManager] directly instead (at least that is my working 
theory, so I need to subclass NSFontManager to test that), so passing a 
different sender to -changeFont: even though it implements the -convertFont: 
message, means I don’t get the chance to step in and modify the text view’s 
contents in the normal way - I’m going to have to subclass NSFontManager 
instead.

I won’t comment on what I think of this architecture.

—Graham





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Customising NSFontManager

2015-11-11 Thread Ken Thomases
On Nov 11, 2015, at 7:51 PM, Graham Cox  wrote:
> 
> According to the docs for NSFontManager:
> 
> 
> + setFontPanelFactory:
> Sets the class used to create the Font panel to the given class.
> 
> Discussion
> Invoke this method before accessing the Font panel in any way, such as in the 
> application delegate’s applicationWillFinishLaunching: method.
> 
> 
> I’m doing exactly this, as the very first line of 
> -applicationWillFinishLaunching, but I get an error that the shared Font 
> Manager instance already exists. Is there an earlier time I can use, or a 
> better way to reliably set the FM factory class?

Probably best to put it in main().

The app delegate is typically instantiated in the MainMenu NIB (or storyboard, 
I guess).  Therefore, there's no possibility that any method will be invoked on 
it until that NIB is loaded.  If the NIB contains a placeholder for the shared 
font manager or anything which uses it (like the Font menu), then you can't get 
in front of it reliably in methods of the app delegate.  So, you have to make 
the call before the NIB is loaded.  main() is the easiest place for that.

If that doesn't work, you may need to use a custom subclass of NSApplication 
and put it in an override of -run, before calling through to super.

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Set editable string into NSTextFieldCell

2015-11-11 Thread Raglan T. Tiger



> On Nov 11, 2015, at 3:58 PM, Graham Cox  wrote:
> 
> If it’s not working, you might have done something elsewhere that is 
> preventing it working as it should.

without going into reasons why I was returning nil in objectValueForTableColumn

returning a value from my dataSource makes it work as desired 


-rags

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Issue with NSTokenFieldCell in NSTableView and bindings..

2015-11-11 Thread Samuel Williams
Hi Everyone.

I'm trying to do something which in theory is rather simple: Use a
NSTokenFieldCell in a NSTableView and bind the table column value to the
token field.

I've had two problems:

1/ The binding doesn't seem to propagate the value back to the model.
2/ Occasional crashes when editing the column.

I've put a sample app together with a README which includes screenshots
outlining the issues and filed a bug report with Apple (
https://github.com/ioquatix/TableViewTokenCellTest). I spent a couple of
hours working through the undocumented API trying to see if there were any
entry points I could use but while I made some progress I didn't manage to
fix the above issues.

I was wondering the following:

a/ I've filed a bug report but this a blocker for a commercial app I'm
working on. I have some code level support requests available. Does this
seem like a reasonable issue to bring to Apple at that level?

b/ Has anyone run into these issues and found any solutions? I'm thinking
one option might be to try and use a view based table-view rather than a
cell based one. Any ideas here would be appreciated.

Thanks,
Samuel
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com