irc client with cocoa

2011-07-27 Thread David Remacle
Hello,

Is there a class or a small framework for irc client ? 

Thank's 
--
David Remacle
lis...@clampin.com






___

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

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


Re: Disable Lion's window restoration?

2011-07-27 Thread Gerd Knops

On Jul 26, 2011, at 5:20 AM, Jean-Daniel Dupas wrote:

> 
> Le 26 juil. 2011 à 02:33, Gerd Knops a écrit :
> 
>> Hi,
>> 
>> Is there an application-global way of disabling window restoration?
>> 
>> All I can find is NSWindow's "- (BOOL)isRestorable" method (and it's 
>> relatives).
>> 
>> I was hoping for something more global, like a "- 
>> (BOOL)shouldRestoreWindows" method in the application delegate protocol or 
>> the NSDocumentController class or somewhere.
>> 
>> Thanks
>> 
>> Gerd
> 
> The key used by System Preferences to managed this setting is 
> NSQuitAlwaysKeepsWindows, and it is stored in the global user defaults domain.
> I think you can override this setting per application by explicitly setting 
> this user default to false in your application.
> I don't know if it works, but it may be worth the try.
> 
Thanks, that does the trick.

Gerd

___

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

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


Re: irc client with cocoa

2011-07-27 Thread Nick Zitzmann

On Jul 27, 2011, at 3:54 AM, David Remacle wrote:

> Hello,
> 
> Is there a class or a small framework for irc client ? 



Nick Zitzmann


___

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

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


Re: Cocoa-dev Digest, Vol 8, Issue 565

2011-07-27 Thread Martin Stanley
I also have implemented a UITextField for numeric (currency and percentage) 
input. Here is my experience:
1- I found the Number Pad keyboard fatally lacking due to omission of a decimal 
point character and a "Done" key. So use a Numbers and Punctuation keyboard.
2- I did not use a UIPickerView because I think this is too much work for the 
user. (This of course is debatable).

I used:
-(BOOL)textField:(UITextField *)textField 
shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString 
*)string
to disallow unwanted characters based on context and:
- (void)textFieldDidEndEditing:(TVDecimalNumberTextField *)textField
to ensure an in-range value.

Hope this helps,
Martin

On 2011-07-26, at 6:43 AM, cocoa-dev-requ...@lists.apple.com wrote:

> Message: 5
> Date: Mon, 25 Jul 2011 19:29:06 -0700
> From: Howard Siegel 
> Subject: Re: UITextField Questions
> To: "cocoa-dev@lists.apple.com" 
> Cc: Brooke Gravitt 
> Message-ID:
>   
> Content-Type: text/plain; charset=ISO-8859-1
> 
> On Mon, Jul 25, 2011 at 18:31, Brooke Gravitt  wrote:
> 
>> On Mon, Jul 25, 2011 at 9:19 PM, Conrad Shultz
>>  wrote:
>>> Take a look at UITextInputTraits to specify a numeric keyboard. (IIRC
>> this can be done in IB too.)
>>> 
>>> Take a look at UITextFieldDelegate's textFieldShouldEndEditing: method to
>> perform validation of input.
>>> 
>>> I should also point out that often a text field is not the most
>> appropriate control for restricted numeric input. If you have a reasonably
>> small finite set of input values, consider UIPickerView. If you have a
>> finite range for input, consider UISlider.
>>> 
>>> (Sent from my iPhone.)
>>> 
>>> --
>>> Conrad Shultz
>> 
>> Conrad,
>> 
>> Thanks for the response! The fields in question are for setting a
>> price and a percentage, respectively. They don't seem to fit into
>> either category. I'll take a look at the UITextInputTraits && the
>> delegate's textFieldShouldEndEditing method as well!
>> 
>> Thanks!
>> 
>> Brooke
>> 
> 
> Brooke,
> 
> You would likely be much better off using UIPickerViews, or a UIPickerView
> and a UISlider as Conrad suggests. If the UISlider doesn't give you enough
> selection precision, then use another UIPickerView. You use the UITextField
> to keep the value for display purposes, but use the UIPickerViews for the
> value selection.
> 
> In order to use the UITextField for display and the UIPickerView for the
> value
> selection instead of the keypad you would need to create the UIPickerViews
> and then set the UITextField inputView to the appropriate UIPickerView. When
> the user taps in the text field, instead of a keypad coming up, the picker
> view
> will come up. You can also set the inputAccesoryView to a UIToolbar that
> contains a "done" button so the picker view can be dismissed once the
> user selects the value.
> 
> The picker view for the percentage would contain 2 or 3 columns for the
> decimal part (0 to 100) and as many columns for the fractional part as
> needed.
> 
> The picker view for the price would contain as many columns for the
> dollar amount and 2 columns for the pennies. This assumes that the
> price value isn't too outrageously large that you can't fit the dollar
> amount
> in to columns such that the picker view becomes too wide, and you can
> get pretty wide if you drop the font size used for the columns.
> 
> I can dig out some links to StackOverflow threads that I used to code up
> exactly this type of user interface in an app that I am writing.
> 
> - h
> 

___

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

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


Re: Cocoa-dev Digest, Vol 8, Issue 565

2011-07-27 Thread Martin Stanley
(oops, corrected response below; sorry)

I also have implemented a UITextField for numeric (currency and percentage) 
input. Here is my experience:
1- I found the Number Pad keyboard fatally lacking due to omission of a decimal 
point character and a "Done" key. So use a Numbers and Punctuation keyboard.
2- I did not use a UIPickerView because I think this is too much work for the 
user. (This of course is debatable).

I used:
-(BOOL)textField:(UITextField *)textField 
shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString 
*)string
to disallow unwanted characters based on context and:
- (BOOL)textFieldShouldEndEditing:(TVDecimalNumberTextField *)textField
to ensure an in-range value.

Hope this helps,
Martin

On 2011-07-26, at 6:43 AM, cocoa-dev-requ...@lists.apple.com wrote:

> Message: 5
> Date: Mon, 25 Jul 2011 19:29:06 -0700
> From: Howard Siegel 
> Subject: Re: UITextField Questions
> To: "cocoa-dev@lists.apple.com" 
> Cc: Brooke Gravitt 
> Message-ID:
>   
> Content-Type: text/plain; charset=ISO-8859-1
> 
> On Mon, Jul 25, 2011 at 18:31, Brooke Gravitt  wrote:
> 
>> On Mon, Jul 25, 2011 at 9:19 PM, Conrad Shultz
>>  wrote:
>>> Take a look at UITextInputTraits to specify a numeric keyboard. (IIRC
>> this can be done in IB too.)
>>> 
>>> Take a look at UITextFieldDelegate's textFieldShouldEndEditing: method to
>> perform validation of input.
>>> 
>>> I should also point out that often a text field is not the most
>> appropriate control for restricted numeric input. If you have a reasonably
>> small finite set of input values, consider UIPickerView. If you have a
>> finite range for input, consider UISlider.
>>> 
>>> (Sent from my iPhone.)
>>> 
>>> --
>>> Conrad Shultz
>> 
>> Conrad,
>> 
>> Thanks for the response! The fields in question are for setting a
>> price and a percentage, respectively. They don't seem to fit into
>> either category. I'll take a look at the UITextInputTraits && the
>> delegate's textFieldShouldEndEditing method as well!
>> 
>> Thanks!
>> 
>> Brooke
>> 
> 
> Brooke,
> 
> You would likely be much better off using UIPickerViews, or a UIPickerView
> and a UISlider as Conrad suggests. If the UISlider doesn't give you enough
> selection precision, then use another UIPickerView. You use the UITextField
> to keep the value for display purposes, but use the UIPickerViews for the
> value selection.
> 
> In order to use the UITextField for display and the UIPickerView for the
> value
> selection instead of the keypad you would need to create the UIPickerViews
> and then set the UITextField inputView to the appropriate UIPickerView. When
> the user taps in the text field, instead of a keypad coming up, the picker
> view
> will come up. You can also set the inputAccesoryView to a UIToolbar that
> contains a "done" button so the picker view can be dismissed once the
> user selects the value.
> 
> The picker view for the percentage would contain 2 or 3 columns for the
> decimal part (0 to 100) and as many columns for the fractional part as
> needed.
> 
> The picker view for the price would contain as many columns for the
> dollar amount and 2 columns for the pennies. This assumes that the
> price value isn't too outrageously large that you can't fit the dollar
> amount
> in to columns such that the picker view becomes too wide, and you can
> get pretty wide if you drop the font size used for the columns.
> 
> I can dig out some links to StackOverflow threads that I used to code up
> exactly this type of user interface in an app that I am writing.
> 
> - h
> 

___

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

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


Re: Two NSTableViews, two data sources, one data model?

2011-07-27 Thread Gary L. Wade
I found it cleaner to have a separate object from my document be the data 
source (and delegate) for four separate views (table, outline, browser, 
collection) showing a folder hierarchy.

- Gary L. Wade (Sent from my iPhone)

On Jul 26, 2011, at 10:53 PM, Izak van Langevelde  wrote:

> I currently have a single NSDocument subclass, which is also a data source 
> for two different tables. Because the two tables show different aspects of 
> the data and the code gets a little cluttered up, I am thinking about 
> implementing two separate data sources, one for each table, both fetching its 
> data from the same data model. 
> 
> The only way I see right now, is keep the data model in the NSDocument 
> subclass, and to connect both data sources to the File Owner, which is a 
> Window Controller, and from there access the document. Is there a more direct 
> way of achieving this?
> ---
> Grinnikend door het leven...
___

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

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


Re: How can i change a app position and size?

2011-07-27 Thread David Duncan
On Jul 26, 2011, at 6:14 PM, Diego Alvarez Nogueira wrote:

> 1)Why do I have some differences in get bounds between cocoa and applescript? 
> for instance: on 'originString' and 'sizeString' are 
> returned({1920,106,1280,800}) and with applescript ("set _bounds to get 
> bounds of window window_number") are returned ({1920, 106, 3200, 906}).


This is probably a holdover from the classic Mac OS days when rectangles were 
described as left/top/right/bottom. Core Graphics describes rectangles as 
left/top/width/height instead, which is what you are seeing from the CGWindow 
API.
--
David Duncan

___

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

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


Re: irc client with cocoa

2011-07-27 Thread Paul Franz
I found this one that is a wrapper for the libircclient. It looks light

http://www.stupendous.net/projects/irc-client-cocoa-framework/

Paul Franz

On Wed, Jul 27, 2011 at 11:20 AM, Nick Zitzmann  wrote:
>
> On Jul 27, 2011, at 3:54 AM, David Remacle wrote:
>
>> Hello,
>>
>> Is there a class or a small framework for irc client ?
>
> 
>
> Nick Zitzmann
> 
>
> ___
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/paul.p.franz%40gmail.com
>
> This email sent to paul.p.fr...@gmail.com
>
___

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

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


Re: Receiving unicode keyboard input

2011-07-27 Thread Bill Appleton
Hi Aki,

Thanks for responding. The problem is that Safari or webkit does not
implement this new spec correctly, i have filed a webkit bug and included a
copy below.

I could try to do something clever to dance around this, but then if they
change it i would have a deployed problem in the field.

I was wondering if it is possible to create text events out of the NPAPI
reported keydowns and then call interpretKeyEvents to receive the unicode
string in a hidden window

(in other words sidestep the browser dependent implementation of this)

But in our stand-alone product (forget NPAPI for a second) we can't get
interpretKeyEvents to deliver unicode, it just delivers the same string as
keydown.

It's supposed to deliver unicode, for like an option-e, e keypress, right?
Or do we need to do more that use interpretKeyEvents to get unicode
translations?


Thanks in advance,

Bill








SAFARI BUG REPORT

On Safari, typing the "g" key will generate a (1) key down event and then
(2) a key up event with no call to NPCocoaEventTextInput

--> this is wrong because i used the kNPEventStartIME flag, see FireFox
behavior below

On Safari, typing "option-e" and then "e" will generate (1) key up event and
then (2) a NPCocoaEventTextInput event with "accented e", and then (3) a key
up event

--> this is wrong because there is a strange key up event sent at first, see
FireFox behavior below

Based on my understanding of the spec Safari or webkit is implementing this
incorrectly

https://wiki.mozilla.org/NPAPI:CocoaEventModel

On FireFox, typing the "g" key will generate a (1) key down event and then
(2) a NPCocoaEventTextInput with "g" and then NO key up event
On FireFox, typing "option-e" and then "e" will generate (1) key down event,
(2) a NPCocoaEventTextInput event with "accented e" and then NO key up event













On Tue, Jul 26, 2011 at 4:12 PM, Aki Inoue  wrote:

> Bill,
>
> You cannot directly access the Cocoa text handling method inside the NPAPI
> plugins.
>
> Instead the NPAPI's Cocoa extension defines the composition handling logic
> by itself.
>
> Refer to the 'Text Input' section in this document <
> https://wiki.mozilla.org/NPAPI:CocoaEventModel>.
>
> Aki
>
> On 2011/07/23, at 8:59, Bill Appleton wrote:
>
> > Hi All,
> >
> > For an NPAPI plugin we need to receive Unicode keyboard input. We are
> > calling interpretKeyEvents and receiving the insertText message, but if I
> > type option-e (for example) we are not getting the accented-e character.
> >
> > Can anyone shed some light on the right way to get unicode characters?
> > Unfortunately we cannot use all the core Text stuff because (as
> mentioned)
> > this is an NPAPI plugin and we don't even have access to the output view
> or
> > window.
> >
> >
> > Best,
> >
> > Bill Appleton
> > ___
> >
> > 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:
> > http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com
> >
> > This email sent to a...@apple.com
>
>
___

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

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


UIAlertView with UITextField

2011-07-27 Thread Dan Hopwood
Hi,

I have come across a undocumented method of the UIAlertView class called:

addTextFieldWithValue:label:

This works really well and is exactly what I am looking for however a little
reading tells me Apple may reject submissions that use this private API. I
wondered if anyone knew this was the case before I commit to using it?

Many thanks,

Dan
___

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

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


Re: UIAlertView with UITextField

2011-07-27 Thread David Duncan
On Jul 27, 2011, at 10:02 AM, Dan Hopwood wrote:

> This works really well and is exactly what I am looking for however a little 
> reading tells me Apple may reject submissions that use this private API.


Yes, you will be rejected for using private API.
--
David Duncan

___

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

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


Re: UIAlertView with UITextField

2011-07-27 Thread Dan Hopwood
Thanks David. And do you or does anyone else know if Apple would permit
implementing something like the following, which gives a very similar
result:

http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html

Thanks,

Dan


On Jul 27, 2011, at 18:14, David Duncan  wrote:

On Jul 27, 2011, at 10:02 AM, Dan Hopwood wrote:

This works really well and is exactly what I am looking for however a
little reading tells me Apple may reject submissions that use this private
API.


Yes, you will be rejected for using private API.
--
David Duncan
___

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

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


Re: Dialog Command Keys

2011-07-27 Thread Bill Appleton
hi all,

oh man i hate to belabor this issue but i have studied every suggestion and
the docs and i cannot figure this out

the problem is that i cannot get command keys to work on dialog text, even
dialogs run and managed by cocoa

as suggested i set the target for my menu items to nil, and also made sure
that in my app menu bar the needed items were active

after doing this when a dialog is up and you cut text you see the menu
flash, there is no beep, but the text is still not cut

if a dialog is not up and you hit command-x you also see the menu flash and
there is no beep, so this was perhaps imaginary progress

i have various other windows in my app for text editing and all of them work
fine and get their command keys no problem

in textedit for example the text in the open file dialog can be edited with
the app menu, and the menu reacts to the text, for example you can't cut if
there is no selection

my menus have setAutoEnablesItems:NO and i enable them as needed but they
are enabled when dialogs are up

i'm not sure the issues raised so far are related to the problem. its as if
the dialogs in my app are not in the responder chain for key events


best

bill











On Tue, Jul 26, 2011 at 10:44 AM, Kyle Sluder  wrote:

> On Tue, Jul 26, 2011 at 10:30 AM, Bill Appleton
>  wrote:
> > hi all
> >
> > i set the target and the action on my menu items -- this is so that i can
> > get my handler called when someone selects a menu item
> > i will re-read the event handler docs with regard to menu items (no
> keyboard
> > issues) and see if that helps
>
> Ah, there's your problem. You need to set these targets to nil, which
> is equivalent to wiring them up to First Responder in a nib.
>
> --Kyle Sluder
>
___

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

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


Re: Dialog Command Keys

2011-07-27 Thread Raleigh Ledet
The target of the menus should be nil and you need to set the action to what 
standard controls expect them to be. Namely:

cut: @selector(cut:)
copy: @selector(copy:)
paste: @selector(paste:)

so basically:

[cutMenuItem setTarget:nil]
[cutMenuItem setAction:@selector(cut:)]

This of course means that you also have to rename your custom handler to also 
have the same name. Or, you can do the following:
- (void)cut:(id)sender {
[self mySpecialCutHandler];
}

-raleigh

On Jul 27, 2011, at 11:26 AM, Bill Appleton wrote:

> hi all,
> 
> oh man i hate to belabor this issue but i have studied every suggestion and
> the docs and i cannot figure this out
> 
> the problem is that i cannot get command keys to work on dialog text, even
> dialogs run and managed by cocoa
> 
> as suggested i set the target for my menu items to nil, and also made sure
> that in my app menu bar the needed items were active
> 
> after doing this when a dialog is up and you cut text you see the menu
> flash, there is no beep, but the text is still not cut
> 
> if a dialog is not up and you hit command-x you also see the menu flash and
> there is no beep, so this was perhaps imaginary progress
> 
> i have various other windows in my app for text editing and all of them work
> fine and get their command keys no problem
> 
> in textedit for example the text in the open file dialog can be edited with
> the app menu, and the menu reacts to the text, for example you can't cut if
> there is no selection
> 
> my menus have setAutoEnablesItems:NO and i enable them as needed but they
> are enabled when dialogs are up
> 
> i'm not sure the issues raised so far are related to the problem. its as if
> the dialogs in my app are not in the responder chain for key events
> 
> 
> best
> 
> bill
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Tue, Jul 26, 2011 at 10:44 AM, Kyle Sluder  wrote:
> 
>> On Tue, Jul 26, 2011 at 10:30 AM, Bill Appleton
>>  wrote:
>>> hi all
>>> 
>>> i set the target and the action on my menu items -- this is so that i can
>>> get my handler called when someone selects a menu item
>>> i will re-read the event handler docs with regard to menu items (no
>> keyboard
>>> issues) and see if that helps
>> 
>> Ah, there's your problem. You need to set these targets to nil, which
>> is equivalent to wiring them up to First Responder in a nib.
>> 
>> --Kyle Sluder
>> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com
> 
> This email sent to le...@apple.com

___

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

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


Re: Dialog Command Keys

2011-07-27 Thread Bill Appleton
Thanks Raleigh that fixes the problem.

 I had a single handler for all menu items that used menu tags to get a menu
and item id, so i will apply your fix below.

our app is enterprise software and has one code base for windows and mac so
this issue was related to the portability requirements


best

Bill





On Wed, Jul 27, 2011 at 11:39 AM, Raleigh Ledet  wrote:

> The target of the menus should be nil and you need to set the action to
> what standard controls expect them to be. Namely:
>
> cut: @selector(cut:)
> copy: @selector(copy:)
> paste: @selector(paste:)
>
> so basically:
>
> [cutMenuItem setTarget:nil]
> [cutMenuItem setAction:@selector(cut:)]
>
> This of course means that you also have to rename your custom handler to
> also have the same name. Or, you can do the following:
> - (void)cut:(id)sender {
>[self mySpecialCutHandler];
> }
>
> -raleigh
>
> On Jul 27, 2011, at 11:26 AM, Bill Appleton wrote:
>
> > hi all,
> >
> > oh man i hate to belabor this issue but i have studied every suggestion
> and
> > the docs and i cannot figure this out
> >
> > the problem is that i cannot get command keys to work on dialog text,
> even
> > dialogs run and managed by cocoa
> >
> > as suggested i set the target for my menu items to nil, and also made
> sure
> > that in my app menu bar the needed items were active
> >
> > after doing this when a dialog is up and you cut text you see the menu
> > flash, there is no beep, but the text is still not cut
> >
> > if a dialog is not up and you hit command-x you also see the menu flash
> and
> > there is no beep, so this was perhaps imaginary progress
> >
> > i have various other windows in my app for text editing and all of them
> work
> > fine and get their command keys no problem
> >
> > in textedit for example the text in the open file dialog can be edited
> with
> > the app menu, and the menu reacts to the text, for example you can't cut
> if
> > there is no selection
> >
> > my menus have setAutoEnablesItems:NO and i enable them as needed but they
> > are enabled when dialogs are up
> >
> > i'm not sure the issues raised so far are related to the problem. its as
> if
> > the dialogs in my app are not in the responder chain for key events
> >
> >
> > best
> >
> > bill
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Jul 26, 2011 at 10:44 AM, Kyle Sluder 
> wrote:
> >
> >> On Tue, Jul 26, 2011 at 10:30 AM, Bill Appleton
> >>  wrote:
> >>> hi all
> >>>
> >>> i set the target and the action on my menu items -- this is so that i
> can
> >>> get my handler called when someone selects a menu item
> >>> i will re-read the event handler docs with regard to menu items (no
> >> keyboard
> >>> issues) and see if that helps
> >>
> >> Ah, there's your problem. You need to set these targets to nil, which
> >> is equivalent to wiring them up to First Responder in a nib.
> >>
> >> --Kyle Sluder
> >>
> > ___
> >
> > 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:
> > http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com
> >
> > This email sent to le...@apple.com
>
>
___

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

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


Re: Dialog Command Keys

2011-07-27 Thread Kyle Sluder
On Wed, Jul 27, 2011 at 11:57 AM, Bill Appleton
 wrote:
> our app is enterprise software and has one code base for windows and mac so
> this issue was related to the portability requirements

Perhaps you could use the problems you've encountered in this thread
to advocate for giving the requisite development attention to each of
your supported platforms instead of targeting cross-platform UI
compatibility.

--Kyle Sluder
___

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

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


Re: Dialog Command Keys

2011-07-27 Thread Bill Appleton
hi kyle i agree. we are in transition that direction, its great to see the
mac growing in popularity it provides justification for the effort.

best bill




On Wed, Jul 27, 2011 at 12:13 PM, Kyle Sluder  wrote:

> On Wed, Jul 27, 2011 at 11:57 AM, Bill Appleton
>  wrote:
> > our app is enterprise software and has one code base for windows and mac
> so
> > this issue was related to the portability requirements
>
> Perhaps you could use the problems you've encountered in this thread
> to advocate for giving the requisite development attention to each of
> your supported platforms instead of targeting cross-platform UI
> compatibility.
>
> --Kyle Sluder
>
___

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

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


Re: Receiving unicode keyboard input

2011-07-27 Thread Aki Inoue
Bill,

> Thanks for responding. The problem is that Safari or webkit does not 
> implement this new spec correctly, i have filed a webkit bug and included a 
> copy below.
OK.  I cannot comment on the behavior since I'm not WebKit :-).

> I could try to do something clever to dance around this, but then if they 
> change it i would have a deployed problem in the field.
I can recommend to try this approach, though.

> I was wondering if it is possible to create text events out of the NPAPI 
> reported keydowns and then call interpretKeyEvents to receive the unicode 
> string in a hidden window
The Unicode input process is a complex beast involving user interactions.  So, 
you just cannot achieve it without showing UI.
Safari shows the auxiliary window for managing inputs when serving plugins.

In order to bypass the WebKit functionality, you need to have an NSView 
implementing NSTextInputClient protocol that works with NSTextInputContext.

> But in our stand-alone product (forget NPAPI for a second) we can't get 
> interpretKeyEvents to deliver unicode, it just delivers the same string as 
> keydown.
Yes, as mentioned above, you need to work with NSTextInputContext by conforming 
to NSTextInputClient.

Aki

On 2011/07/27, at 9:35, Bill Appleton wrote:

> Hi Aki,
> 
> Thanks for responding. The problem is that Safari or webkit does not 
> implement this new spec correctly, i have filed a webkit bug and included a 
> copy below.
> 
> I could try to do something clever to dance around this, but then if they 
> change it i would have a deployed problem in the field.
> 
> I was wondering if it is possible to create text events out of the NPAPI 
> reported keydowns and then call interpretKeyEvents to receive the unicode 
> string in a hidden window
> 
> (in other words sidestep the browser dependent implementation of this)
> 
> But in our stand-alone product (forget NPAPI for a second) we can't get 
> interpretKeyEvents to deliver unicode, it just delivers the same string as 
> keydown.
> 
> It's supposed to deliver unicode, for like an option-e, e keypress, right? Or 
> do we need to do more that use interpretKeyEvents to get unicode translations?
> 
> 
> Thanks in advance,
> 
> Bill
> 
> 
> 
> 
> 
> 
> 
> 
> SAFARI BUG REPORT
> 
> On Safari, typing the "g" key will generate a (1) key down event and then (2) 
> a key up event with no call to NPCocoaEventTextInput 
> 
> --> this is wrong because i used the kNPEventStartIME flag, see FireFox 
> behavior below
> 
> On Safari, typing "option-e" and then "e" will generate (1) key up event and 
> then (2) a NPCocoaEventTextInput event with "accented e", and then (3) a key 
> up event
> 
> --> this is wrong because there is a strange key up event sent at first, see 
> FireFox behavior below
> 
> Based on my understanding of the spec Safari or webkit is implementing this 
> incorrectly
> 
> https://wiki.mozilla.org/NPAPI:CocoaEventModel
> 
> On FireFox, typing the "g" key will generate a (1) key down event and then 
> (2) a NPCocoaEventTextInput with "g" and then NO key up event
> On FireFox, typing "option-e" and then "e" will generate (1) key down event, 
> (2) a NPCocoaEventTextInput event with "accented e" and then NO key up event
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Tue, Jul 26, 2011 at 4:12 PM, Aki Inoue  wrote:
> Bill,
> 
> You cannot directly access the Cocoa text handling method inside the NPAPI 
> plugins.
> 
> Instead the NPAPI's Cocoa extension defines the composition handling logic by 
> itself.
> 
> Refer to the 'Text Input' section in this document 
> .
> 
> Aki
> 
> On 2011/07/23, at 8:59, Bill Appleton wrote:
> 
> > Hi All,
> >
> > For an NPAPI plugin we need to receive Unicode keyboard input. We are
> > calling interpretKeyEvents and receiving the insertText message, but if I
> > type option-e (for example) we are not getting the accented-e character.
> >
> > Can anyone shed some light on the right way to get unicode characters?
> > Unfortunately we cannot use all the core Text stuff because (as mentioned)
> > this is an NPAPI plugin and we don't even have access to the output view or
> > window.
> >
> >
> > Best,
> >
> > Bill Appleton
> > ___
> >
> > 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:
> > http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com
> >
> > This email sent to a...@apple.com
> 
> 

___

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


Re: UIAlertView with UITextField

2011-07-27 Thread glenn andreas
And how well will that approach work with an updated release that moves things 
around to different locations?  Hint: many apps have broken with updated OS 
releases when system UI objects are changed internally.

Anything that hard codes in coordinate assumptions of system views is 
problematic - especially code like: 

[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)]

or:

CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 
130.0); 
[self setTransform:translate];

The hard coding of coordinate values also can cause problems when running the 
OS with a non-English language (since the metrics of different languages can be 
different).


On Jul 27, 2011, at 12:47 PM, Dan Hopwood wrote:

> Thanks David. And do you or does anyone else know if Apple would permit
> implementing something like the following, which gives a very similar
> result:
> 
> http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html
> 
> Thanks,
> 
> Dan
> 
> 
> On Jul 27, 2011, at 18:14, David Duncan  wrote:
> 
> On Jul 27, 2011, at 10:02 AM, Dan Hopwood wrote:
> 
> This works really well and is exactly what I am looking for however a
> little reading tells me Apple may reject submissions that use this private
> API.
> 
> 
> Yes, you will be rejected for using private API.
> --
> David Duncan
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/gandreas%40mac.com
> 
> This email sent to gandr...@mac.com

Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

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


Lion's new "Resume" feature, document restoration, and splash screens

2011-07-27 Thread Sean McBride
Hi all,

How can one support the new Resume feature and also show a splash screen at app 
launch, before documents are opened?

I've added logs to my NSApplicationDelegate and observed the launch sequence 
and it goes like:

awakeFromNib
applicationWillFinishLaunching
NSApplicationDidFinishRestoringWindowsNotification
applicationDidFinishLaunching

If I try to display a simple UI from applicationWillFinishLaunching, say by 
using [NSApp runModalForWindow:...], it starts a run loop, which processes an 
open apple event, which starts the whole Resume mechanism, which then restores 
documents.

Is there a point where I can show a simple window with an "I Agree" button, and 
until it's pressed, prevent any document from opening?

(And I know someone is going to tell me: don't show an icky splash screen... 
that option is being considered too.)

Thanks,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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


Re: Lion's new "Resume" feature, document restoration, and splash screens

2011-07-27 Thread John Joyce

On Jul 28, 2011, at 7:29 AM, Sean McBride wrote:

> Hi all,
> 
> How can one support the new Resume feature and also show a splash screen at 
> app launch, before documents are opened?
> 
> I've added logs to my NSApplicationDelegate and observed the launch sequence 
> and it goes like:
> 
> awakeFromNib
> applicationWillFinishLaunching
> NSApplicationDidFinishRestoringWindowsNotification
> applicationDidFinishLaunching
> 
> If I try to display a simple UI from applicationWillFinishLaunching, say by 
> using [NSApp runModalForWindow:...], it starts a run loop, which processes an 
> open apple event, which starts the whole Resume mechanism, which then 
> restores documents.
> 
> Is there a point where I can show a simple window with an "I Agree" button, 
> and until it's pressed, prevent any document from opening?
> 
> (And I know someone is going to tell me: don't show an icky splash screen... 
> that option is being considered too.)
> 
> Thanks,
> 
> --
> 
> Sean McBride, B. Eng s...@rogue-research.com
> Rogue Researchwww.rogue-research.com
> Mac Software Developer  Montréal, Québec, Canada

Please don't show splash screens.
Launch your app. 
Use lazy loading.
Users don't want brand marketing every time they use an app. They want to get 
back to work.___

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

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


Re: Lion's new "Resume" feature, document restoration, and splash screens

2011-07-27 Thread Philip Ershler

On Jul 27, 2011, at 5:16 PM, John Joyce wrote:

> 
> On Jul 28, 2011, at 7:29 AM, Sean McBride wrote:
> 
>> Hi all,
>> 
>> How can one support the new Resume feature and also show a splash screen at 
>> app launch, before documents are opened?
>> 
>> I've added logs to my NSApplicationDelegate and observed the launch sequence 
>> and it goes like:
>> 
>> awakeFromNib
>> applicationWillFinishLaunching
>> NSApplicationDidFinishRestoringWindowsNotification
>> applicationDidFinishLaunching
>> 
>> If I try to display a simple UI from applicationWillFinishLaunching, say by 
>> using [NSApp runModalForWindow:...], it starts a run loop, which processes 
>> an open apple event, which starts the whole Resume mechanism, which then 
>> restores documents.
>> 
>> Is there a point where I can show a simple window with an "I Agree" button, 
>> and until it's pressed, prevent any document from opening?
>> 
>> (And I know someone is going to tell me: don't show an icky splash screen... 
>> that option is being considered too.)
>> 
>> Thanks,
>> 
>> --
>> 
>> Sean McBride, B. Eng s...@rogue-research.com
>> Rogue Researchwww.rogue-research.com
>> Mac Software Developer  Montréal, Québec, Canada
> 
> Please don't show splash screens.
> Launch your app. 
> Use lazy loading.
> Users don't want brand marketing every time they use an app. They want to get 
> back to work.___
> 

At a minimum, please oh please include a preference to turn the splash screen 
off.

Thanks, Phil


___

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

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


Re: Lion's new "Resume" feature, document restoration, and splash screens

2011-07-27 Thread Dave Fernandes
License agreements are still a necessity. This seems to be what the OP is 
asking about, and not simply a marketing splash screen.

I used to put this check in my document controller's 
openUntitledDocumentAndDisplay:error: and 
openDocumentWithContentsOfURL:display:error: methods. Unfortunately, these 
methods are not called for restored windows.

On 2011-07-27, at 7:16 PM, John Joyce wrote:

> 
> On Jul 28, 2011, at 7:29 AM, Sean McBride wrote:
> 
>> Hi all,
>> 
>> How can one support the new Resume feature and also show a splash screen at 
>> app launch, before documents are opened?
>> 
>> I've added logs to my NSApplicationDelegate and observed the launch sequence 
>> and it goes like:
>> 
>> awakeFromNib
>> applicationWillFinishLaunching
>> NSApplicationDidFinishRestoringWindowsNotification
>> applicationDidFinishLaunching
>> 
>> If I try to display a simple UI from applicationWillFinishLaunching, say by 
>> using [NSApp runModalForWindow:...], it starts a run loop, which processes 
>> an open apple event, which starts the whole Resume mechanism, which then 
>> restores documents.
>> 
>> Is there a point where I can show a simple window with an "I Agree" button, 
>> and until it's pressed, prevent any document from opening?
>> 
>> (And I know someone is going to tell me: don't show an icky splash screen... 
>> that option is being considered too.)
>> 
>> Thanks,
>> 
>> --
>> 
>> Sean McBride, B. Eng s...@rogue-research.com
>> Rogue Researchwww.rogue-research.com
>> Mac Software Developer  Montréal, Québec, Canada
> 
> Please don't show splash screens.
> Launch your app. 
> Use lazy loading.
> Users don't want brand marketing every time they use an app. They want to get 
> back to work.___
> 
> 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:
> http://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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Lion's new "Resume" feature, document restoration, and splash screens

2011-07-27 Thread Sean McBride
On Jul 27, 2011, at 19:39, Dave Fernandes wrote:

> License agreements are still a necessity. This seems to be what the OP is 
> asking about, and not simply a marketing splash screen.

Thanks for the on-topic reply!  (Sad that even though I anticipated the 'don't 
do that comments', they still came.)

> I used to put this check in my document controller's 
> openUntitledDocumentAndDisplay:error: and 
> openDocumentWithContentsOfURL:display:error: methods. Unfortunately, these 
> methods are not called for restored windows.

Indeed.  I used to do something similar (don't recall exactly, the code is at 
work).

So I take it you are in the same boat?

Perhaps the open AppleEvents themselves could be intercepted, queued, and 
processed later... any other ideas?

Sean

___

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

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


Re: Lion's new "Resume" feature, document restoration, and splash screens

2011-07-27 Thread Quincey Morris
On Jul 27, 2011, at 15:29, Sean McBride wrote:

> (And I know someone is going to tell me: don't show an icky splash screen... 
> that option is being considered too.)

Incidentally, in the context of Lion and automatic termination/resume, it's no 
longer just the ickiness that's a problem. The deeper problem is that 
application existence has been divorced from process existence. When your 
application's *process* starts up, the *application* may already be active (and 
vice versa). If you display a splash screen, you risk having it pop up at 
random times, from the user's point of view.

You seem to be trying to display a license agreement (when the application has 
been installed/updated?). I'd suggest you pitch this as a modal interaction 
rather than a splash screen. So, you might want to enter this mode just before 
opening a document, rather than just after starting the process. Or make the 
agreement window application-modal, without preventing (at least) resumed 
windows from being restored.




___

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

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


Tracking down CALayer problem in iTunes plug-in

2011-07-27 Thread Graham Cox
I'm developing an iTunes visualizer plug-in using the new SDK, which supports 
Cocoa views and by extension, layers.

But debugging these things is awkward because it's a plug-in and you can't run 
iTunes in a debugger. But you can log stuff to the console, which is something.

When I clean-up my visualizer view, I see this in the console: 

28/07/11 12:43:40 AMiTunes[22132]   attempting to modify layer that is 
being finalized - 0x1ec78650

This occurs just after my view (which has layers) is deallocated. My visualizer 
then becomes unusable - the graphics are shot to hell and cease to work, even 
though it goes through the motions of creating a new view and layers apparently 
successfully.

If I don't remove my view from the iTunes host view when told to, I don't get 
this error, and my visualizer works OK subsequently. But it doesn't play nice 
with other visualizers if I don't clean up my view, so I need to do this.

Where does this error come from and what does it mean? I think I'm being 
careful not to attempt to modify or access or invoke any methods on any layers 
after I perform the clean-up, so this appears to be something internal either 
to iTunes or to the layers subsystem.


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

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


Re: 1. Creating a TCP server? (Rick Mann)

2011-07-27 Thread Jens Alfke

On Jul 26, 2011, at 4:20 PM, John MacMullin wrote:

> http://developer.apple.com/library/mac/#samplecode/CocoaEcho/Introduction/Intro.html
>  ?

CocoaEcho is pretty messy. Might be useful as reference for looking at how to 
do some things, but I wouldn’t recommend basing your app on it, not when there 
are higher-level classes with clean APIs available to build on. (E.g. 
MYNetwork, AsyncSocket.)

—Jens___

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

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


Running Cocoa from a dynamic library

2011-07-27 Thread Guido Sales Calvano
Dear community,

I'm building a project I've been thinking about for 14 years now. Finally doing 
it. But I've hit a stumbling block... So I need help...

I'm trying to wrap Ogre3D a graphics engine in a javascript api using v8, and 
then load that as a module in node js, a javascript framework focussed on web 
communication tasks such as running a server. Node js can load other javascript 
modules that are bound to C++ code as dynamic libraries.

Ogre3D however, uses a cocoa window to render on, and obviously I want user 
input. But if I start ogre in a dynamic library ui events register incorrectly. 
Only clicks and drag operations are detected, but no key input or mouse move 
events. This only happens when I load the library dynamically. I know this 
because I created a simple program that just loaded my dynamic lib to test the 
assumption. If I don't load the lib dynamically, but link directly everything 
works fine.

The answer is probably quite simple, once you know where to look, but I don't 
know where to look. So please help.

Kind regards (:

Guido
___

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

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


Drawing text in a ImageAndTextCell in a nsoutlineview works as desired in Leopard. Broken in Snow Leopard and Lion

2011-07-27 Thread ktam
I'm having problems with code that works fine on Leopard, slightly  
broken in Snow Leopard and even more so in Lion. In Leopard the  
drawing of text in a selected cell with a colour label applied is  
drawing white instead of black, if the selected cell is the first in a  
list of items with a colour label applied. This also happens in Lion  
but in Lion if a later item with a colour label is selected then the  
text is drawn über black.


Correct behaviour in Leopard:
http://www.yvs.eu.com/files/Leopard.png
http://www.yvs.eu.com/files/Leopard2.png

Correct behaviour in Snow Leopard when it is not the first item with a  
colour label selected:

http://www.yvs.eu.com/files/SnowLeopard2.png
Incorrect behaviour in Snow Leopard & Lion when it is the first item  
with a colour label selected:

http://www.yvs.eu.com/files/SnowLeopard3.png

Extra broken behaviour in Lion with the über black:
http://www.yvs.eu.com/files/Lion1.png

I have an NSOutlineView and I use a subclass of a view controller to  
control it and to be its delegate.


I use a modified version of Apple's ImageAndTextCell class to draw  
each item in the single column outline view. The image and text cell  
class draws the image and a colour label where necessary like those  
applied in Finder and then asks super (NSTextCell) to draw the text.


In the controller and delegate I have implemented the delegate method  
where I set the colour label if necessary:


- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn  
item:(id)item


{
MYImageAndTextCell *imgTxtCell = cell;
MyNode *myNode = item;

// The if is strictly not necessary but highlights that the label  
name is NULL when there is no label.

if ([myNode colourLabel])
[cell setLabelName:[myNode colourLabel]];
else
[cell setLabelName:NULL];
}

In the ImageAndTextCell I have gone over the top in trying to apply  
the correct background style when I have a colour label applied  
(NSBackgroundStyleLight which previously resulted in the text drawn  
black). I have overridden interiorBackgroundStyle  
drawWithFrame:cellFrame:inView and drawInteriorWithFrame:inView


- (NSBackgroundStyle)interiorBackgroundStyle
{
if ([self labelName])
return NSBackgroundStyleLight;
return [super interiorBackgroundStyle];
}

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
if ([self labelName])
{
...
NSDrawThreePartImage(labelFrame, leftEndCapImage, middleImage,
rightEndCapImage, FALSE, NSCompositeSourceOver,
1.0, TRUE);
[self setBackgroundStyle:NSBackgroundStyleLight];
}
// super will draw the text
[super drawInteriorWithFrame:cellFrame inView:controlView];
}

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
// Carve up the cell so that part of the cell is the image, and  
the other part is the text cell.

NSSize imageSize [[self image] size] ;
NSRect imageFrame;
NSRect textFrame;

NSDivideRect(cellFrame, &imageFrame, &textFrame, 5 +  
imageSize.width, NSMinXEdge);
[[self image] compositeToPoint:imageFrame.origin  
operation:NSCompositeSourceOver];

if ([self labelName])
[self setBackgroundStyle:NSBackgroundStyleLight];
[super drawWithFrame:textFrame inView:controlView];
}

What changed in snow leopard to override setting the background style  
to NSBackgroundStyleLight for the first item and why do I get the über  
black text in Lion? What am I doing wrong?


Kevin

___

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

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


Drawing of text in outline view image and text cell correct in Leopard, broken in snow leopard

2011-07-27 Thread Kevin Meaney
I'm having problems with code that works fine on Leopard, and broken in Snow 
Leopard. In Leopard the drawing of text in a selected cell with a colour label 
applied is drawing white instead of black, if the selected cell is the first in 
a list of items with a colour label applied.

Correct behaviour in: Leopard
http://yvs.eu.com/files/Leopard.png
http://yvs.eu.com/files/Leopard2.png

Correct behaviour in Snow Leopard when it is not the first item with a colour 
label selected:
http://yvs.eu.com/files/SnowLeopard2.png

I have an NSOutlineView and I use a subclass of a view controller to control it 
and to be its delegate.

I use a modified version of Apple's ImageAndTextCell class to draw each item in 
the single column outline view. The image and text cell class draws the image 
and a colour label where necessary like those applied in Finder and then asks 
super (NSTextCell) to draw the text.

In the controller and delegate I have implemented the delegate method where I 
set the colour label if necessary:

- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn 
item:(id)item

{
MYImageAndTextCell *imgTxtCell = cell;
MyNode *myNode = item;

// The if is strictly not necessary but highlights that the label name is 
NULL when there is no label.
if ([myNode colourLabel])
[cell setLabelName:[myNode colourLabel]];
else
[cell setLabelName:NULL];
}
In the ImageAndTextCell I have gone over the top in trying to apply the correct 
background style when I have a colour label applied (NSBackgroundStyleLight 
which previously resulted in the text drawn black). I have overridden 
interiorBackgroundStyle drawWithFrame:cellFrame:inView and 
drawInteriorWithFrame:inView

- (NSBackgroundStyle)interiorBackgroundStyle
{
if ([self labelName])
return NSBackgroundStyleLight;
return [super interiorBackgroundStyle];
}

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
if ([self labelName])
{
...
NSDrawThreePartImage(labelFrame, leftEndCapImage, middleImage,
rightEndCapImage, FALSE, NSCompositeSourceOver,
1.0, TRUE);
[self setBackgroundStyle:NSBackgroundStyleLight];
}
// super will draw the text
[super drawInteriorWithFrame:cellFrame inView:controlView];
}

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
// Carve up the cell so that part of the cell is the image, and the other 
part is the text cell.
NSSize imageSize [[self image] size] ;
NSRect imageFrame;
NSRect textFrame;

NSDivideRect(cellFrame, &imageFrame, &textFrame, 5 + imageSize.width, 
NSMinXEdge);
[[self image] compositeToPoint:imageFrame.origin 
operation:NSCompositeSourceOver];
if ([self labelName])
[self setBackgroundStyle:NSBackgroundStyleLight];
[super drawWithFrame:textFrame inView:controlView];
}
What changed in snow leopard to override setting the background style to 
NSBackgroundStyleLight for the first item? What am I doing wrong?

ktam___

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

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