Selectable and editable spreadsheet-like matrix
Selectable and editable spreadsheet-like matrix
- Subject: Selectable and editable spreadsheet-like matrix
- From: Stefan Urbanek <email@hidden>
- Date: Mon, 3 Oct 2005 12:10:04 +0200
Hi,
I am working on an application where I would like to have a spread-
sheet like matrix (with predefined fixed size). Hehaviour of the
matrix should be:
- single click - select cells
- double click - edit cell contents
I prepare the matrix:
matrix = [[NSMatrix alloc] initWithFrame:rect];
[matrix setMode:NSListModeMatrix];
[matrix setAllowsEmptySelection:YES];
[matrix setSelectionByRect:YES];
[matrix setTarget:self];
[matrix setAction:@selector(cellSelectionChanged:)];
[matrix setDoubleAction:@selector(cellDoubleClicked:)];
Cells areset as [cell setEditable:NO].
Now on double click I do:
- (void)cellDoubleClicked:(id)sender
{
NSLog(@"Cell doubleclicked");
[[matrix selectedCell] setEditable:YES];
[matrix selectText];
}
With this, the cell is editable on second click, not immediately on
the first double click. Note that I have not yet implemented removal
of editable cell after editing is finished.
What is the proper way of achieving the goal? Where I can find some
examples?
Thank you,
Stefan Urbanek
_______________________________________________
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