NSTableView is not updated on [reloadData]

2009-07-23 Thread Alexander Bokovikov

Hi, All,

So, I'm continuing :)
I've connected my NSTableView with AppController (in IB) setting  
AppController, as NSTableView's datasource. Then I've added a couple  
of methods to the AppController to implement NSTableDataSource protocol:


- (int)numberOfRowsInTableView:(NSTableView *)tableView;

- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row;

Also I have a timer in my app, which should recalculate something from  
time to time and, as a result of this procedure, table row count (as  
well as values) should be updated. onTimer: method is like this one:


- (void)onTimer:(NSTimer*)timer {
//
// here we do some actions, leading to actual changes in the table  
content.

//
[myTable reloadData];
}

It all is correct for the first look. Isn't it? Now what is  
happening.  numberOfRowsInTableView: is called only once, yet before  
AppController's awakeFromNib is called. At that moment nothing yet is  
initialized (initialization goes in awakeFromNib), so  
numberOfRowsInTableView: returns zero.


Nothing happens when [myTable reloadData] is called within onTimer:  
procedure. None of delegated methods are called, so my table is always  
empty, though new data (of nonzero length) are created.


So, my question is - how to make table view to change its row count  
and update the data?


Thanks.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableView is not updated on [reloadData]

2009-07-23 Thread I. Savant

On Jul 23, 2009, at 11:21 AM, Alexander Bokovikov wrote:


[myTable reloadData];

...

Nothing happens when [myTable reloadData] is called within onTimer:


  Is your myTable outlet connected to the table view?

--
I.S.




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableView is not updated on [reloadData]

2009-07-23 Thread David Blanton

Are you sure

 [myTable reloadData];

is being executed?  reloadData will cause numberOfRowsInTableView to  
be called.



On Jul 23, 2009, at 9:21 AM, Alexander Bokovikov wrote:


Hi, All,

So, I'm continuing :)
I've connected my NSTableView with AppController (in IB) setting  
AppController, as NSTableView's datasource. Then I've added a couple  
of methods to the AppController to implement NSTableDataSource  
protocol:


- (int)numberOfRowsInTableView:(NSTableView *)tableView;

- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row;

Also I have a timer in my app, which should recalculate something  
from time to time and, as a result of this procedure, table row  
count (as well as values) should be updated. onTimer: method is like  
this one:


- (void)onTimer:(NSTimer*)timer {
//
// here we do some actions, leading to actual changes in the table  
content.

//
[myTable reloadData];
}

It all is correct for the first look. Isn't it? Now what is  
happening.  numberOfRowsInTableView: is called only once, yet before  
AppController's awakeFromNib is called. At that moment nothing yet  
is initialized (initialization goes in awakeFromNib), so  
numberOfRowsInTableView: returns zero.


Nothing happens when [myTable reloadData] is called within onTimer:  
procedure. None of delegated methods are called, so my table is  
always empty, though new data (of nonzero length) are created.


So, my question is - how to make table view to change its row count  
and update the data?


Thanks.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/airedale%40tularosa.net

This email sent to aired...@tularosa.net




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: closed - NSTableView is not updated on [reloadData]

2009-07-23 Thread Alexander Bokovikov


On 23.07.2009, at 21:25, I. Savant wrote:


 Is your myTable outlet connected to the table view?


I'm fool... :( sorry... I was pretty sure it is, but really it isn't.   
Also I was sure that BAD_ACCESS exception should occur if not  
initialized outlet is used to send a message to.


Fixed it.

Thanks for so quick reply!

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: closed - NSTableView is not updated on [reloadData]

2009-07-23 Thread Graham Cox


On 24/07/2009, at 1:52 AM, Alexander Bokovikov wrote:

Also I was sure that BAD_ACCESS exception should occur if not  
initialized outlet is used to send a message to.



Definitely not.

Uninitialized outlets are set to nil, and messages to nil are legal -  
they simply swallow the messages. On t e whole this is much safer than  
crashing but can lead to the odd bug where nothing happens and you  
don't immediately know why.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: closed - NSTableView is not updated on [reloadData]

2009-07-23 Thread Greg Guerin

Alexander Bokovikov wrote:

Also I was sure that BAD_ACCESS exception should occur if not  
initialized outlet is used to send a message to.


An uninitialized outlet is always nil.  It is always legal to send  
messages to nil, although some returned values may be undefined.  Re- 
read the basic docs on messaging, if necessary.


It may be illegal to perform other operations with nil, so don't make  
the opposite mistake of thinking that just because sending a message  
to nil is legal, so is everything else.


  -- GG

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com