Re: Binding alignment property of NSTextField
Re: Binding alignment property of NSTextField
- Subject: Re: Binding alignment property of NSTextField
- From: Luc Van Bogaert <email@hidden>
- Date: Sun, 28 Oct 2012 11:25:10 +0100
I have confirmed that the viewcontroller property is set correctly. While trying to find out why the textfield alignment isn't updated accordingly through the binding, I have found that when I set the textfield's stringValue (eg. to the same string), the alignment does get updated to its correct setting. But setting the stringValue of the textfield seems way too costly for what I'm trying to achieve.
So, I tried to send the textfield setNeedsDisplay: and setNeedsLayout: messages when the alignment property changes, but that doesn't update the alignment of the textfield.
On 27 Oct 2012, at 16:06, Luc Van Bogaert <email@hidden> wrote:
> Yes, I'm using a synthesised setter to change the property value. I am also observing the property (to redraw the controller's view whenever something changes) and this way I can confirm that the property is indeed changed in a KVO compliant manner.
>
> One thing I forgot to mention is that I'm using a NSValueTransformer with the binding to translate the enum property values to the proper alignment setting for the textfield.
>
>
> On 27 Oct 2012, at 11:58, Ken Thomases <email@hidden> wrote:
>
>> On Oct 27, 2012, at 4:26 AM, Luc Van Bogaert wrote:
>>
>>> The textfield alignment is bound to an enum property of the viewcontroller. The strange thing is that, when I create a *new* viewcontroller object from the nib, the textfield alignment is set correctly based on the current enum property value. So, it seems that the binding indeed works, but
>>>
>>> when I set the enum property of an existing viewcontroller object to some other value, the textfield alignment is not adjusted accordingly.
>>
>> This suggests that your are modifying the property in a non-KVO-compliant manner. Are you calling the setter or are you directly changing the instance variable?
>>
>> Regards,
>> Ken
>>
>
> --
> Luc Van Bogaert
> email@hidden
> http://www.rixhon.be
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
--
Luc Van Bogaert
email@hidden
http://www.rixhon.be
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden