Re: NSTableView - how to select text when editing a column?
Re: NSTableView - how to select text when editing a column?
- Subject: Re: NSTableView - how to select text when editing a column?
- From: "Roni Music" <email@hidden>
- Date: Fri, 7 Jul 2006 17:16:21 +0200
----- Original Message -----
From: "Matt Neuburg" <email@hidden>
To: "Roni Music" <email@hidden>
Cc: <email@hidden>
Sent: Friday, July 07, 2006 4:50 PM
Subject: Re: NSTableView - how to select text when editing a column?
On Fri, 7 Jul 2006 09:36:57 +0200, "Roni Music" <email@hidden>
said:
I'm using the NSTableView and everything is working fine.
To edit a specific row/column, I do:
int theRow = [mMyTableView selectedRow];
[mMyTableView editColumn:0 row:theRow withEvent:nil select:YES];
This displays the edit field and and I can type some new text, fine.
However I would like not to have the entire text selected but just a
part of it.
I'm displaying file names such as:
"AFileName.mp3 "and I would like just the"AFileName" portion selected
and not the file extension ".mp3"
I've googled a lot for a solution but can't find any.
Sometimes just walking the docs is better than googling. You are, as you
say, using an NSTableView, so start there. An NSTableView is an NSControl.
An NSControl has a currentEditor. The currentEditor is an NSTextView. An
NSTextView has a setSelectedRange: method.
thanks for responding!
I'm new to Cocoa (Carbon/C++ programmer)
If I get it right, I should do:
NSTextView *textView = [mMyTableView currentEditor];
NSRange aRange;
aRange.location = 0;
aRange.length = 3; // just a test
[textView setSelectedRange:aRange];
But when and from were should I call this?
Rolf
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden