[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Editing NSCell Text In NSView With Mouse Down Event
From: |
Renaud Molla |
Subject: |
Re: Editing NSCell Text In NSView With Mouse Down Event |
Date: |
Wed, 17 Jan 2007 20:33:07 +0100 |
Hello,
Maybe I didn't really get the point about what you'd like to do, but,
you could do this:
- Handle mouse down in your custom view,
- If the click/double click /whatever you want triggers the edition
of the text
- Create an NSTextField instance
- Set the frame of the text field so that it matches your
'editable' label
- Add it as a subview of your primary view
- set the delegate of the text field to an instance you
want
OR
- set the action and target and set it to be sent at
end editing
- On the edition end callback (whether the delegate method or the
action)
save the text and remove the text field from the
superview
This is just a solution I already did to edit text on documents that
are not primarily intended to edit text.
Renaud.
On Jan 17, 2007, at 7:27 PM, Daniel J Farrell wrote:
Hi,
I've had a look at the docs for NSTextField it doesn't have a '-
drawAtPosition' type method. When I'm drawing on the NSView I want
to be able to place editable text at different positions. I only
think it is possible to predefine where a NSTextField should be
drawn; using Gorm, and then subsequently change the values. I
should have made that clear.
I am drawing strings containing numbers. They are axis tic mark
labels for a plotting programme. This is why I would like this
editable functionality.
Cheers,
Dan
On 17 Jan 2007, at 15:58, Fred Kiefer wrote:
Daniel J Farrell schrieb:
Hello.
I am drawing a NSCell in a NSView subclass using,
NSCell *cell = [[NSCell alloc] initTextCell:@"NSCell"];
[cell setStringValue:@"blahh blahh"];
I now want the user to be able to edit the next by clicking it
with the
mouse. When the editing is finished I then want to extract the new
value. I have tried using,
[cell setEnabled:YES];
[cell setSelectable:YES];
[cell setEditable:YES];.
However, this did not appear to do anything. I assume that I need to
tell the NSCell exactly how to repond to the mouse. How do I do
this? I
have found,
-editWithFrame: inView: editor: delegate: event:
in the GNUstep documentation but I'm unsure on how to start using
it.
Why aren't you using a NSTextField here. Most likely this is what you
are looking for. If you want to stick with a bacic NSCell then you
will
have to use your own NSControl subclass and change the method
mouseDown:
for it. Again you should have a look at NSTextField to see what
you need
to do.
Hope this helps,
Fred
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep
----------------------------------------------------------------------
-----------------
Orange vous informe que cet e-mail a ete controle par l'anti-virus
mail.Aucun virus connu a ce jour par nos services n'a ete detecte.