NSComboBox like point size in TextEdit

2020-01-29 Thread Lars C. Hassing via Cocoa-dev
I want my NSComboBox to behave like the point size combo in TextEdit:
User places cursor in the combobox textfield,
User presses arrow down - the menu opens
User presses arrow down several times stepping down in the menu.
User presses Enter to select the highlighted point size.
- or user presses Escape to cancel the operation.

In any case I only seem to receive
   comboBoxWillPopUp
   comboBoxSelectionDidChange
   comboBoxSelectionDidChange
   comboBoxSelectionDidChange
   comboBoxWillDismiss

textDidEndEditing is NOT called even though the NSComboBox changes the text in 
case the user presses Enter.

Do I really have to note the current selection in comboBoxSelectionDidChange
and then in comboBoxWillDismiss examine the NSApp.currentEvent
to see if it was a key event that should apply the selection (Enter/Return) or 
cancel (Escape/Tab)
or even a mouse event, the user may click in list to select or click outside 
list to cancel!

I thought the AppKit was my friend and would handle all the details...
/Lars


___

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


Preventing app from being restored or saving info in "Saved Application State"

2019-11-10 Thread Lars C. Hassing via Cocoa-dev
I have developed two Cocoa apps, one launching the other helper app.

If number two app crashes then macOS may ask the user if he wants to relaunch 
it,
but it makes no sense launching it on its own, because it must be launched in a 
controlled manner and environment from the first app.

I believe data in "~/Library/Saved Application State" is being used for this,
how can I programmatically in app two tell that restoration is not useful ?

I’ve tried myMainWindow.restorable = NO.


I’ve learned that you can do
   defaults write com.mycompany.myapp2 NSQuitAlwaysKeepsWindows -bool false
but I cannot ask users to open Terminal.

Maybe I could use
   [NSUserDefaults.standardUserDefaults setBool:NO forKey:@“ 
NSQuitAlwaysKeepsWindows”];
but i hope there is another way
/Lars

___

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: Thoughts on Cocoa

2019-10-04 Thread Lars C. Hassing via Cocoa-dev

On 4 Oct 2019, at 21.00, Jens Alfke wrote:

The people I hear complaining about this are those who, like you, didn't move 
to Cocoa. Carbon was a _temporary_ transition API*. It was necessary when Mac 
OS X shipped in March 2001, but even though it wasn't yet formally deprecated, 
it was clear it would be.

Carbon might have started as a temporary solution, but it ended up a very good 
solution,
which Apple stated in "It’s the Future” (Last updated: 2004-06-28)

   "Apple is committed to the HIViews, Carbon events, and nib files for Carbon 
implementations of the user interface.
All new controls and other features will be based on HIView.
If you want your application to take advantage of the latest features, you 
need to adopt the modern HIToolbox.”

https://web.archive.org/web/20080725021421/http://developer.apple.com/documentation/Carbon/Conceptual/Upgrading_HIToolbox/upgrading_hitoolbox_conc/chapter_2_section_7.html


When my company was going to the Mac platform (in addition to Sun+AIX+Windows),
Carbon seemed like a good choice.
Now we have just wasted several man years going to Cocoa.
Microsoft is really the good guys, as somebody said, not letting developers 
down.
/Lars

___

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