• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: end edit for NSTextView & switch to next key view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: end edit for NSTextView & switch to next key view


  • Subject: Re: end edit for NSTextView & switch to next key view
  • From: Esteban <email@hidden>
  • Date: Tue, 16 Apr 2002 13:17:51 -0700

Someone this didnt get into the list...

On Tuesday, April 16, 2002, at 08:36 AM, Esteban wrote:
>On Tuesday, April 16, 2002, at 02:48 AM, Bill Cheeseman wrote:

>From his description, it sounds like he thinks he is intercepting the Tab
>key but really isn't, because of not covering all the items mentioned above.


Sorry for the apparent vagueness, I wanted to focus on effectively switching to the nextKeyView, which apparently is not happening, and not the part where I actually try to get the Tab key press detected.

I rolled my own subclass of NSTextView which I'm calling MessageTextView. In MessageTextView's keyDown method I am intercepting the Tab and Enter key. When I find a Tab key or Enter key I send it to my infamous delegate's custom method I made up called endEdit:(id)textView which is NOT the same as the NSTextView's delegate method textShouldEndEditing:(id)aTextObject inherited from NSText. The delegate of MessageTextView is called ReminderController. ReminderController's endEdit method then calls NSLog(@"tab or enter key is pressed"). When I run the application and press key or enter, i get the message : tab or enter key is pressed.

So far that works fine like its supposed to. There's a better way of intercepting the event at doCommandBySelector, which I read about yesterday looking at the archives, but for now I'm sticking with intercepting at keyDown which is working fine at the moment.

That said, the problem seems to lie inside the ReminderController's endEdit:(id)textView method. I check to make sure that the TextView I'm getting back is the one I want, just to be on the safe side.

In ReminderController, the MessageTextView is assigned to IBOutlet id messageTextView, and its enclosing scroll view is called messageTextScrollView.

So in ReminderController's endEdit, I also have id sheet pointing to the configuration sheet i brought up. I have set the messageTextScrollView to have its nextKeyDown be the radio button in Interface Builder. I've double checked to make sure. I have even set the messageTextView to have the radio button as its nextKeyDown as well. Then I call [sheet selectNextKeyView:nil]. This works but it skips over the radio button and leaves then a blinking insertion point (or cursor as you prefer calling it) in the messageTextView.

I've also tried calling [sheet selectNextKeyViewFollowingView:messageTextView]; that gives the same results.
I've tried calling [sheet selectNextKeyViewFollowingView:messageTextScrollView; same results.

I've tried to force end of editing by adding [sheet endEditingFor:messageTextView] and [sheet endEditingFor:messageTextScrollView]; before calling [sheet selectNextKeyView] and that doesnt help.

I've tried making the nextKeyView of messageTextScrollView the firstResponder, that doesnt work. I think i also tried making messageTextView's nextKeyView the first responder as well and that didnt work.

I've tried messageTextScrollView's setNextKeyView to be the radio buttons and then try [sheet selectNextKeyView], but that also skips over the radio button and leaves a blinking cursor in messageTextView. I think i just about tried every combination i can think of to get things working properly. Skipping over the radio button doesn't bother me so much, but leaving a blinking cursor in the messageTextView does bother me. I mean its not active, and the other text fields I have also get an active blinking cursor.

I also tried the following:

.........................................................................
.
...
//this is a method in ReminderController, delegate method for MessageTextView
- (void)endEdit:(id) aTextView
{
if([[messageTextScrollView documentView] isEqualTo:aTextView]) {
id sheet = [configurationController sheet];

NSLog(@"make someone else first responder");
if ([sheet makeFirstResponder:sheet]) {
/* All fields are now valid; it's safe to use fieldEditor:forObject:
to claim the field editor. */
NSLog(@"end field editing successful");
}
else {
/* Force first responder to resign. */
[sheet endEditingFor:nil];
NSLog(@"forced end field editing");
}

[sheet selectNextKeyView:nil];
}
.........................................................................
.
...

calling [sheet makeFirstResponder:sheet] works perfectly and I am greeted with "end filed editing successful", except when I call [sheet selectNextKeyView:anyObject] it also leaves the blinking cursor in the messageTextView, and moves the focus into the subjectTextField that preceeds the messageTextView in the configuration sheet.

I'm forced to call [sheet endEditingFor:messageTextView]; in order to get the next message [sheet selectNextKeyView:anyObject] to move to the next key view. Although it doesnt really move into the nextKeyView, because the next properly IB wired view is set as being the NSRadioMatrix, and not hourTextField that it ends up at. Blinking cursor in messageTextView persists.

I appreciate any help provided. If you need me to clarify something please let me know. I don't mind putting the whole source up somewhere. The application is freeware and open source anyways. Just let me know.

Thank you,
-Esteban
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: NSFileManager and aliases
  • Next by Date: Is it safe to use NSMailDelivery, Linker warning
  • Previous by thread: Re: end edit for NSTextView & switch to next key view
  • Next by thread: Confused and Mental, help!
  • Index(es):
    • Date
    • Thread