Enabling cut and paste in modal window

  • Hello all,

    I'm loading a NSWindow and displaying it modally with NSApp -
    runModalForWindow:

    This is working great except the NSTextFields within the window don't
    support cut and paste.  Googling has uncovered a lot of cryptic
    references to overloading worksWhenModal, but from my reading this is
    done on other panels you wish to have active concurrently with your
    modal window.  I just want to be able to paste text from other apps
    *into* this modal window (it's my registration dialog).

    mike
    --
    Mike Woodworth
    <mike...>
  • on 11/6/07 2:00 PM, <mikelists...> purportedly said:

    > I'm loading a NSWindow and displaying it modally with NSApp -
    > runModalForWindow:
    >
    > This is working great except the NSTextFields within the window don't
    > support cut and paste.  Googling has uncovered a lot of cryptic
    > references to overloading worksWhenModal, but from my reading this is
    > done on other panels you wish to have active concurrently with your
    > modal window.  I just want to be able to paste text from other apps
    > *into* this modal window (it's my registration dialog).

    I do this all the time, and copy/cut/paste always work. What are all of the
    symptoms? Are the menu items enabled? Have you changed the menus' action
    methods?

    Best,

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
  • on 11/6/07 9:28 PM, <mikelists...> purportedly said:

    >
    > I'm calling it from my main -awakeFromNib, so the main menu is
    > loaded... I see the whole app menu, so I know its loading, it's just
    > not active.

    I remember having a problem some time ago that might be related. IIRC, I
    dealt with it by using -performSelector:withObject:afterDelay:. Making the
    app go through a run loop iteration seemed to allow everything to load
    properly.

    Otherwise, I am at a loss. I know there is nothing in -runModalForWindow:
    that interferes with copy/paste, as I do this all the time. As long as there
    is an object in the responder chain that responds to the copy/paste actions,
    they should enable.

    I am CC'ing the list in case there is someone else who has an idea.

    > On Nov 6, 2007, at 6:57 PM, Keary Suska wrote:
    >
    >> on 11/6/07 3:53 PM, <mikelists...> purportedly said:
    >>
    >>> The edit menu is not showing up at all.  Menus are all set to
    >>> autoenable.  I haven't touched the default wiring of anything in the
    >>> edit menu.  Quit is also not working.  None of the menu items are.
    >>>
    >>> The only strange thing I can think of that I'm doing  - the modal
    >>> NSWindow is being loaded from a separate NIB, while the default menu
    >>> is in MainMenu.nib
    >>
    >> It sounds like your modal panel is being loaded before the mainmenu
    >> nib is
    >> loaded. AFAIK, if the main menu isn't loaded, you won't get any menu
    >> functions--note that copy/paste is usually a menu function. Even
    >> keystroke
    >> equivalents invoke menu items by default.
    >>
    >> I recommend bringing your panel up afterwards, such as from
    >> -applicationDidFinishLaunching or in the NSApplication delegate
    >> -awakeFromNib. If you can't do this, you'll need some sort of
    >> workaround
    >> such as invisible/offscreen buttons with key equivalents.

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
  • Am 06.11.2007 um 22:00 schrieb mike woodworth:
    > This is working great except the NSTextFields within the window
    > don't support cut and paste.

      They should. Maybe you're not letting them through in one of your
    validateMenuItem: methods?

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today