FROM : Stéphane
DATE : Tue Mar 04 15:49:15 2008
On Mar 4, 2008, at 3:35 PM, Nick Rogers wrote:
> Hi,
> I have two NSTableView in my app (tableView1 and tableView2).
> If I select a row in tableView1 and then if I select a row in
> tableView2, I want the row in tableView1 to be deselected.
> For this I'm using [tableView1 deselectAll: nil], but it leads to
> calling the delegate method again and leads to deselection of the
> selected row in tableView2 also.
> So this way both table view's stands deselected.
>
> Is there a noble way to do it?
I'm not sure it's noble since my blood is red but:
> Listing:
>
> - (void)tableViewSelectionDidChange:(NSNotification *)notification
> {
> if ([[notification object] isEqual: tableView1] == YES)
> {
>
if ([tableView1 numberOfSelectedRows]>0)
{
> [tableView2 deselectAll:nil];
>
> // add code here
}
> }
>
> if ([[notification object] isEqual: tableView2] == YES)
> {
>
if ([tableView2 numberOfSelectedRows]>0)
{
> [tableView1 deselectAll:nil];
> // add code here
}
> }
> }
DATE : Tue Mar 04 15:49:15 2008
On Mar 4, 2008, at 3:35 PM, Nick Rogers wrote:
> Hi,
> I have two NSTableView in my app (tableView1 and tableView2).
> If I select a row in tableView1 and then if I select a row in
> tableView2, I want the row in tableView1 to be deselected.
> For this I'm using [tableView1 deselectAll: nil], but it leads to
> calling the delegate method again and leads to deselection of the
> selected row in tableView2 also.
> So this way both table view's stands deselected.
>
> Is there a noble way to do it?
I'm not sure it's noble since my blood is red but:
> Listing:
>
> - (void)tableViewSelectionDidChange:(NSNotification *)notification
> {
> if ([[notification object] isEqual: tableView1] == YES)
> {
>
if ([tableView1 numberOfSelectedRows]>0)
{
> [tableView2 deselectAll:nil];
>
> // add code here
}
> }
>
> if ([[notification object] isEqual: tableView2] == YES)
> {
>
if ([tableView2 numberOfSelectedRows]>0)
{
> [tableView1 deselectAll:nil];
> // add code here
}
> }
> }
| Related mails | Author | Date |
|---|---|---|
| Nick Rogers | Mar 4, 15:35 | |
| Stéphane | Mar 4, 15:49 | |
| Andy Lee | Mar 4, 17:09 | |
| Corbin Dunn | Mar 4, 17:14 | |
| Corbin Dunn | Mar 4, 17:15 | |
| Stephane Sudre | Mar 4, 17:28 | |
| Corbin Dunn | Mar 4, 18:10 |






Cocoa mail archive

