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: 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
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 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
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-26 Thread Bill Appleton
hi greg, this application is the dreamfactory player, this is a stand-alone
development environment and also a NPAPI plugin for chrome, safari and
firefox.
there are huge limitations for npapi, for example, we only get a core
graphics surface to draw the app on not an nsview or an nswindow
the code base must work on windows and mac and this is half a million lines
of c and in order to have portability the dialogs are built out of a
platform independent xml description
but we are always looking for a better way and we probably could use
interface builder more

however the problem i am having is with all dialogs, even cocoa get file and
put file dialogs that are not dynamically built







On Tue, Jul 26, 2011 at 2:38 PM, Gregory Weston  wrote:

> Bill Appleton wrote:
>
> > Based on my app, the dialog boxes have to be created dynamically, so i
> can't
> > use Interface Builder, so they are assembled out of cocoa controls as
> > needed.
> >
> > My dialogs beep when i control-x to cut some selected text
> >
> > What is the simple way for my dialog window to pass these command keys
> > events down to the text views?
> >
> > Thanks in advance
>
> Not to be impertinent but through this thread I'm wondering if the OP is
> putting himself through this pain unnecessarily. There *are* certainly
> legitimate reasons to be building parts of your UI at runtime but in my
> experience it's vanishingly rare, especially for the entire application. Is
> this one of those scenarios where the most beneficial answer to "How do I do
> X" is "Don't?"
>
> So to Bill: What's the situation for your app that you've decided requires
> you to build everything at runtime? *Why* can't you use IB?
>
> Greg
> ___
>
> 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/billappleton%40dreamfactory.com
>
> This email sent to billapple...@dreamfactory.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-26 Thread Gregory Weston
Bill Appleton wrote:

> Based on my app, the dialog boxes have to be created dynamically, so i can't
> use Interface Builder, so they are assembled out of cocoa controls as
> needed.
> 
> My dialogs beep when i control-x to cut some selected text
> 
> What is the simple way for my dialog window to pass these command keys
> events down to the text views?
> 
> Thanks in advance

Not to be impertinent but through this thread I'm wondering if the OP is 
putting himself through this pain unnecessarily. There *are* certainly 
legitimate reasons to be building parts of your UI at runtime but in my 
experience it's vanishingly rare, especially for the entire application. Is 
this one of those scenarios where the most beneficial answer to "How do I do X" 
is "Don't?"

So to Bill: What's the situation for your app that you've decided requires you 
to build everything at runtime? *Why* can't you use IB?

Greg
___

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-26 Thread Kyle Sluder
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-26 Thread Joar Wingfors

On 26 jul 2011, at 10:30, Bill Appleton wrote:

> 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


You typically can't (or at least shouldn't) set a concrete, ie. non-nil, target 
for menu items that may serve different parts of the UI at different times - 
Like Cut / Copy / Paste. You may ask: If I don't set a target, how will the 
menu item find a receiver for its action? Well, that's a service provided by 
the responder chain. One of the core concepts of UI programming on the Mac, so 
hone in on that when you're reading up on t his.

Cheers,

j o a r


___

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-26 Thread Matt Neuburg
On Tue, 26 Jul 2011 09:03:19 -0700, Bill Appleton 
 said:
>The items in the main menu DO have the standard key bindings, they are
>disabled when the modal dialogs come up

Well, that's a bug you need to fix. This might help:

http://www.cocoabuilder.com/archive/cocoa/119051-small-notes-on-enabling-of-menus-in-modal-window.html

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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-26 Thread Bill Appleton
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


thx

bill



On Tue, Jul 26, 2011 at 10:02 AM, Joar Wingfors  wrote:

>
> On 26 jul 2011, at 09:43, Raleigh Ledet wrote:
>
> >> Well, when the dialog field has selected text and i type command-x my
> menu
> >> item's action handler is NOT invoked, because there is a modal dialog up
> I
> >> guess.
> >
> > Wait! Are you saying that you modified the default target/action setup of
> the Cut menu in your main nib file? If so, that would explain everything.
>
>
> What Raleigh means is that the out-of-the-box behavior that we've been
> harping about here depends on these menu items being set up in the default
> way - with the default target (nil) and default actions. If you have
> configured them to have different targets / actions, then all bets are off.
> And again, that would imply that Kyle's suggestion to read up on Cocoa Event
> Handling would be in order.
>
> j o a r
>
>
>
___

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-26 Thread Joar Wingfors

On 26 jul 2011, at 09:43, Raleigh Ledet wrote:

>> Well, when the dialog field has selected text and i type command-x my menu
>> item's action handler is NOT invoked, because there is a modal dialog up I
>> guess. 
> 
> Wait! Are you saying that you modified the default target/action setup of the 
> Cut menu in your main nib file? If so, that would explain everything.


What Raleigh means is that the out-of-the-box behavior that we've been harping 
about here depends on these menu items being set up in the default way - with 
the default target (nil) and default actions. If you have configured them to 
have different targets / actions, then all bets are off. And again, that would 
imply that Kyle's suggestion to read up on Cocoa Event Handling would be in 
order.

j o a r


___

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-26 Thread Bill Appleton
hi all,

>> Wait! Are you saying that you modified the default target/action setup of
the Cut menu in your main nib file? If so, that would explain everything.
>> try starting again with a standard NIB and inspect each item to see what
things you may be missing.

i think this is the right track, our menus are also dynamically generated,
we don't use interface builder at all

the application has an .xib file from the "cocoa empty template" option in
interface builder

so i haven't modified this one way or the other




On Tue, Jul 26, 2011 at 9:45 AM, Gary L. Wade
wrote:

> You had mentioned earlier that your UI is programmatically generated; are
> your menus also in that category? If so, and they need to remain that way,
> try starting again with a standard NIB and inspect each item to see what
> things you may be missing.
>
> - Gary L. Wade (Sent from my iPhone)
>
>
___

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-26 Thread Gary L. Wade
You had mentioned earlier that your UI is programmatically generated; are your 
menus also in that category? If so, and they need to remain that way, try 
starting again with a standard NIB and inspect each item to see what things you 
may be missing.

- Gary L. Wade (Sent from my iPhone)

___

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-26 Thread Joar Wingfors

On 26 jul 2011, at 09:32, Bill Appleton wrote:

> >>  OK, great. In that case it's weird that your cut/copy/paste items are not 
> >> enabled while a text field in your dialog has focus. You have focus set in 
> >> one of your text fields / views, right?
> 
> I just tried enabling the edit menu items when a dialog is up, that didn't 
> change anything. The NSTextField is blinking and typing into the field works, 
> so it has focus.


Note that Cut and Copy will only be enabled if you have something to Cut and 
Copy - In other words, you need a *selection* in the focused text field / view.


> >> Not sure what you mean with "not using the main app menu system"? I'd 
> >> argue that it should be, and that you should be using regular first 
> >> responder based menu item validation for making sure that only the menu 
> >> items that make sense are enabled during your modal session (again 
> >> something that typically works without any additional work on your part).
> 
> Well, when the dialog field has selected text and i type command-x my menu 
> item's action handler is NOT invoked, because there is a modal dialog up I 
> guess. On microsoft windows if you have a text field up on a dialog with 
> focus it just responds to control-x and cuts the text. It doesn't matter what 
> is happening in the application menus. 


The issue is not that you have a modal dialog up, event handling still works 
more or less the same way for modal dialogs. 


j o a r


___

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-26 Thread Andy Lee
On Jul 26, 2011, at 12:32 PM, Bill Appleton wrote:
> On microsoft windows if you have a text field up on a dialog with
> focus it just responds to control-x and cuts the text. It doesn't matter
> what is happening in the application menus.

On the Mac, Command-X typically just works as well. The mechanism may be 
different (it probably goes through the Edit menu, in which "Cut" *should* be 
enabled), but it does normally work.

--Andy

___

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-26 Thread Raleigh Ledet

On Jul 26, 2011, at 9:32 AM, Bill Appleton wrote:
> I just noticed that even if i bring up a stock dialog (like the put file
> dialog to save a file) that command-x still doesn't work. for these dialogs
> it DOES flash (hilite) that menu, but no cutting happens. So I don't think
> it matters how i am running the modal dialogs, because a stock dialog (cocoa
> is running) also has this problem.

Does cmd-x work in the Save panel of other applications. (Say Text Edit, 
Safari, etc…) I bet they do, and the corresponding Edit menu items are enabled 
in those dialogs as well. This tells me you have something wrong in your app.

> 
> Well, when the dialog field has selected text and i type command-x my menu
> item's action handler is NOT invoked, because there is a modal dialog up I
> guess. 

Wait! Are you saying that you modified the default target/action setup of the 
Cut menu in your main nib file? If so, that would explain everything.


-raleigh

___

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-26 Thread Bill Appleton
I just noticed that even if i bring up a stock dialog (like the put file
dialog to save a file) that command-x still doesn't work. for these dialogs
it DOES flash (hilite) that menu, but no cutting happens. So I don't think
it matters how i am running the modal dialogs, because a stock dialog (cocoa
is running) also has this problem.



On Tue, Jul 26, 2011 at 9:29 AM, Andy Lee  wrote:

> On Jul 26, 2011, at 12:03 PM, Bill Appleton wrote:
> > The items in the main menu DO have the standard key bindings, they are
> > disabled when the modal dialogs come up
>
> That is odd. My question is, how do those menu items "know" to be enabled
> when we run a modal dialog the more usual way, using a nib? Seems like
> something I should know but I don't have the answer offhand. I'd search the
> docs but I have to run in a minute -- maybe the answer is in the doc "How
> Modal Windows Work"? Or in the event handling doc mentioned earlier?
>
> > The dialogs are modal
>
> Out of curiosity, how are you displaying your dialogs? Are you using [NSApp
> runModalForWindow:]? Using a modal session? Something else?
>
> --Andy
>
>
___

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-26 Thread Bill Appleton
>>  OK, great. In that case it's weird that your cut/copy/paste items are
not enabled while a text field in your dialog has focus. You have focus set
in one of your text fields / views, right?

I just tried enabling the edit menu items when a dialog is up, that didn't
change anything. The NSTextField is blinking and typing into the field
works, so it has focus.

>> Not sure what you mean with "not using the main app menu system"? I'd
argue that it should be, and that you should be using regular first
responder based menu item validation for making sure that only the menu
items that make sense are enabled during your modal session (again something
that typically works without any additional work on your part).

Well, when the dialog field has selected text and i type command-x my menu
item's action handler is NOT invoked, because there is a modal dialog up I
guess. On microsoft windows if you have a text field up on a dialog with
focus it just responds to control-x and cuts the text. It doesn't matter
what is happening in the application menus.





On Tue, Jul 26, 2011 at 9:17 AM, Joar Wingfors  wrote:

>
> On 26 jul 2011, at 09:03, Bill Appleton wrote:
>
> > The items in the main menu DO have the standard key bindings, they are
> disabled when the modal dialogs come up
> > The items in the right-click menu do NOT have the key bindings but they
> are enabled, i didn't make these menus
> > The dialogs are modal
>
>
> OK, great. In that case it's weird that your cut/copy/paste items are not
> enabled while a text field in your dialog has focus. You have focus set in
> one of your text fields / views, right?
>
>
> > I agree it should just work. Is the problem that the main app menus need
> to be enabled when the dialogs are up? the dialogs are not using the main
> app menu system at that time...
>
>
> Not sure what you mean with "not using the main app menu system"? I'd argue
> that it should be, and that you should be using regular first responder
> based menu item validation for making sure that only the menu items that
> make sense are enabled during your modal session (again something that
> typically works without any additional work on your part).
>
>
> j o a r
>
>
>
___

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-26 Thread Andy Lee
On Jul 26, 2011, at 12:03 PM, Bill Appleton wrote:
> The items in the main menu DO have the standard key bindings, they are
> disabled when the modal dialogs come up

That is odd. My question is, how do those menu items "know" to be enabled when 
we run a modal dialog the more usual way, using a nib? Seems like something I 
should know but I don't have the answer offhand. I'd search the docs but I have 
to run in a minute -- maybe the answer is in the doc "How Modal Windows Work"? 
Or in the event handling doc mentioned earlier?

> The dialogs are modal

Out of curiosity, how are you displaying your dialogs? Are you using [NSApp 
runModalForWindow:]? Using a modal session? Something else?

--Andy

___

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-26 Thread Joar Wingfors

On 26 jul 2011, at 09:03, Bill Appleton wrote:

> The items in the main menu DO have the standard key bindings, they are 
> disabled when the modal dialogs come up
> The items in the right-click menu do NOT have the key bindings but they are 
> enabled, i didn't make these menus
> The dialogs are modal


OK, great. In that case it's weird that your cut/copy/paste items are not 
enabled while a text field in your dialog has focus. You have focus set in one 
of your text fields / views, right?


> I agree it should just work. Is the problem that the main app menus need to 
> be enabled when the dialogs are up? the dialogs are not using the main app 
> menu system at that time...


Not sure what you mean with "not using the main app menu system"? I'd argue 
that it should be, and that you should be using regular first responder based 
menu item validation for making sure that only the menu items that make sense 
are enabled during your modal session (again something that typically works 
without any additional work on your part).


j o a r


___

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-26 Thread Bill Appleton
The items in the main menu DO have the standard key bindings, they are
disabled when the modal dialogs come up

The items in the right-click menu do NOT have the key bindings but they are
enabled, i didn't make these menus

The dialogs are modal

I agree it should just work. Is the problem that the main app menus need to
be enabled when the dialogs are up? the dialogs are not using the main app
menu system at that time...


thanks in advance





On Tue, Jul 26, 2011 at 8:56 AM, Joar Wingfors  wrote:

>
> On 26 jul 2011, at 08:09, Bill Appleton wrote:
>
> > There ARE cut, copy, and paste items in this menu, but they DONT have any
> > command key bindings, maybe that is the problem? i didn't create this
> menu
> > in the first place
>
>
> Yes, that is at least part of the problem. If the items in your main menu
> doesn't have the standard key bindings set, your app won't respond to the
> standard set of keyboard shortcuts. Not too surprising, eh?   ;-)
>
> Secondly, all of this should for the most part "just work". If it doesn't,
> or if you think that you have to provide a lot of custom code to get it
> working, you're doing something wrong. I'd suggest studying up on Cocoa
> Event Handling, like Kyle suggested, in particular the concepts around the
> first responder.
>
> Are the dialogs that you mention modal? If not, how to you put them on
> screen?
>
> j o a r
>
>
>
___

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-26 Thread Joar Wingfors

On 26 jul 2011, at 08:09, Bill Appleton wrote:

> There ARE cut, copy, and paste items in this menu, but they DONT have any
> command key bindings, maybe that is the problem? i didn't create this menu
> in the first place


Yes, that is at least part of the problem. If the items in your main menu 
doesn't have the standard key bindings set, your app won't respond to the 
standard set of keyboard shortcuts. Not too surprising, eh?   ;-)

Secondly, all of this should for the most part "just work". If it doesn't, or 
if you think that you have to provide a lot of custom code to get it working, 
you're doing something wrong. I'd suggest studying up on Cocoa Event Handling, 
like Kyle suggested, in particular the concepts around the first responder.

Are the dialogs that you mention modal? If not, how to you put them on screen?

j o a r


___

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-26 Thread Bill Appleton
The main edit menu items are disabled when the dialog(s) come up.





On Tue, Jul 26, 2011 at 8:23 AM, Kyle Sluder  wrote:

> On Jul 26, 2011, at 8:09 AM, Bill Appleton 
> wrote:
>
> And when i right-click in them i get a clever menu with search in google,
> convert to uppercase, etc.
>
>
> Please note I said "menu bar," not "right-click menu." What about the items
> on the Edit menu?
>
> --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-26 Thread Kyle Sluder
On Jul 26, 2011, at 8:09 AM, Bill Appleton  
wrote:

> And when i right-click in them i get a clever menu with search in google, 
> convert to uppercase, etc.

Please note I said "menu bar," not "right-click menu." What about the items on 
the Edit menu?

--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-26 Thread Bill Appleton
Whoops yes, command-x

So i create some NSTextFields on the dialog window

(can't use Interface Builder, this is a dynamically created dialog)

And when i right-click in them i get a clever menu with search in google,
convert to uppercase, etc.

There ARE cut, copy, and paste items in this menu, but they DONT have any
command key bindings, maybe that is the problem? i didn't create this menu
in the first place


thx




On Tue, Jul 26, 2011 at 8:00 AM, Kyle Sluder  wrote:

> On Jul 26, 2011, at 7:52 AM, Bill Appleton 
> wrote:
>
>
> BUT my question is that it seems like there ought to be an easy or
> automatic way to do this. If i right-click on a text control i get a pop up
> menu with cut, copy, and other options. That same control isn't smart enough
> to handle the control-X key? It just seems strange, I'm looking for the
> right way to do this & don't want to reinvent the wheel for controls in a
> dialog.
>
>
> First, it's Command-X, not Control-X.
>
> Secondly, the way that key equivalents work is that they're sent to the
> menu bar first. In this case, the Cut menu item on the Edit menu should
> claim the Cmd-X shortcut, and then begin it's -validateMenuItem: process
> down the responder responder chain. Since you're talking about cutting text,
> that means you're using an NSTextField, right? The NSTextField's field
> editor responds to -cut: so -validateMenuItem: will be called on the field
> editor. It should return YES if the field is editable, which will cause the
> menu item to send its action (-cut:) to the field editor.
>
> No custom implementation of -performKeyEquivalent: is required.
>
> So: what happens if you select some text in your text field and bring up
> the Edit menu? Is the Cut item disabled? Does it have the proper shortcut
> listed next to it?
>
> --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-26 Thread Kyle Sluder
On Jul 26, 2011, at 7:52 AM, Bill Appleton  
wrote:


> BUT my question is that it seems like there ought to be an easy or automatic 
> way to do this. If i right-click on a text control i get a pop up menu with 
> cut, copy, and other options. That same control isn't smart enough to handle 
> the control-X key? It just seems strange, I'm looking for the right way to do 
> this & don't want to reinvent the wheel for controls in a dialog.

First, it's Command-X, not Control-X.

Secondly, the way that key equivalents work is that they're sent to the menu 
bar first. In this case, the Cut menu item on the Edit menu should claim the 
Cmd-X shortcut, and then begin it's -validateMenuItem: process down the 
responder responder chain. Since you're talking about cutting text, that means 
you're using an NSTextField, right? The NSTextField's field editor responds to 
-cut: so -validateMenuItem: will be called on the field editor. It should 
return YES if the field is editable, which will cause the menu item to send its 
action (-cut:) to the field editor.

No custom implementation of -performKeyEquivalent: is required.

So: what happens if you select some text in your text field and bring up the 
Edit menu? Is the Cut item disabled? Does it have the proper shortcut listed 
next to it?

--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-26 Thread Bill Appleton
In the manual it says:

"However, subclasses of other Application Kit classes (including custom
views) need to provide their own implementations of performKeyEquivalent:.
The implementation should extract the characters for a key equivalent from
the passed-in NSEvent object using the charactersIgnoringModifiers  method
and then examine them to determine if they are a key equivalent it
recognizes. It handles the key equivalent much as it would handle a key
event in keyDown"

i can do that manually for each control in my dialog.

BUT my question is that it seems like there ought to be an easy or automatic
way to do this. If i right-click on a text control i get a pop up menu with
cut, copy, and other options. That same control isn't smart enough to handle
the control-X key? It just seems strange, I'm looking for the right way to
do this & don't want to reinvent the wheel for controls in a dialog.


Best






On Mon, Jul 25, 2011 at 9:47 PM, Kyle Sluder  wrote:

> On Mon, Jul 25, 2011 at 1:43 PM, Bill Appleton
>  wrote:
> > Hi all,
> >
> > Based on my app, the dialog boxes have to be created dynamically, so i
> can't
> > use Interface Builder, so they are assembled out of cocoa controls as
> > needed.
> >
> > My dialogs beep when i control-x to cut some selected text
> >
> > What is the simple way for my dialog window to pass these command keys
> > events down to the text views?
>
> Please read the Cocoa Event Handling Guide:
>
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/Introduction/Introduction.html#//apple_ref/doc/uid/1060i-CH1-SW1
>
> --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-25 Thread Kyle Sluder
On Mon, Jul 25, 2011 at 1:43 PM, Bill Appleton
 wrote:
> Hi all,
>
> Based on my app, the dialog boxes have to be created dynamically, so i can't
> use Interface Builder, so they are assembled out of cocoa controls as
> needed.
>
> My dialogs beep when i control-x to cut some selected text
>
> What is the simple way for my dialog window to pass these command keys
> events down to the text views?

Please read the Cocoa Event Handling Guide:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/Introduction/Introduction.html#//apple_ref/doc/uid/1060i-CH1-SW1

--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


Dialog Command Keys

2011-07-25 Thread Bill Appleton
Hi all,

Based on my app, the dialog boxes have to be created dynamically, so i can't
use Interface Builder, so they are assembled out of cocoa controls as
needed.

My dialogs beep when i control-x to cut some selected text

What is the simple way for my dialog window to pass these command keys
events down to the text views?

Thanks in advance
___

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