Editing BrowserCells only on Double Click --- how?
Editing BrowserCells only on Double Click --- how?
- Subject: Editing BrowserCells only on Double Click --- how?
- From: Niko Matsakis <email@hidden>
- Date: Tue, 3 Jun 2003 19:58:22 -0400 (EDT)
Okay, I'm sure you all are breathlessly awaiting my latest developments.
I solved the problem below (description to follow).
I now have an NSBrowser with editable cells. However, I want them to
only start editing when I *double* click on them: instead, the stupid
things are constantly editable! i.e., when I move my mouse over the
cell, it becomes the I-beam cursor.
How can I change this to act more like the finder?
Anyway, if you care about my solution, here it is: I realized that I was
approaching this from the wrong angle. Instead of trying to
figure out how to call "editWithFrame:inView:editor:delegate:event:",
I could just overload it, call the super, and do whatever I want with
the NSText object later.
That seems to actually work really damn well, which is cool.
niko
On Tue, 3 Jun 2003, Niko Matsakis wrote:
>
Hi there,
>
>
I've got an NSBrowser that uses a custom class of mine for its
>
cells. The cell class isn't really important, it's basically a convenient
>
class that associates some data with the cell and initializes its text
>
value based on that data.
>
>
Now, as it turns out, this cell class represents an XML element and
>
thus the text value it creates looks something like this: "a id='10'",
>
i.e., the name of the element is 'a' and it has an attribute 'id' with
>
the value 10.
>
>
What I'd like to happen is that when I double-click on the cell, I want
>
to be able to edit the name of the element, but not the attributes.
>
>
I'm not sure how to make this work. I'm thinking that if I intercept
>
the double-click event in my application, I can then send a
>
editWithFrame:inView:editor:delegate:event: message to the cell, but
>
I have to create an awful lot of crap to do that.
>
>
Is this the right approach? Is there a simpler one?
>
>
If it is the right approach, where should I get each component? Here are my
>
thoughts:
>
>
1. frame ---> from the NSMatrix for the current column
>
2. view ---> the NSMatrix itself?
>
3. editor --> instantiate an NSText with the initial value of the element name
>
4. delegate > some class of mine, I suppose
>
5. event ---> not sure what this is or what to get one
>
>
>
>
thank you for any assistance!
>
niko
>
_______________________________________________
>
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.
_______________________________________________
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.