NSTrackingArea in tableview issue - cocoa

I have set up my table view to work kinda like the Twitter app meaning when you hover over each row icons will appear on the right side and when leaving the row they will disappear. I coded it based upon this:
mouseExited isn't called when mouse leaves trackingArea while scrolling
The very strange thing is I have a checkbox on each row (along with other text fields, etc.) and when clicking the checkbox it causes the icons for that row to jump to the next row. Clicking the checkbox again will cause them to jump to the next row. This repeats until the icons jump to the last visible row then they will jump to the first visible row and keep repeating this behavior. And it happens only sometimes. :-/ I tried to figure this out but nothing is even being called when this happens meaning no call to tracking areas or mouse entered/exited nothing. Does this make any sense at all and maybe considering I'm trying to recreate how Twitter does it did I code it wrong?
Thanks,
rc

Related

NSTextField dragging values

I am trying to create a text field in the Mac OSX environment that allows a user to select a number and drag horizontally to adjust that number up and down.
I know this can be done because Apple have implemented it in the inspector panel of the Sprite Kit emitter section: see the image
I have tried sub classing NSTextField to capture mouse drag events and doing the math, but they don't seem to get passed through. The mouse down event does though...
I have also tried placing a dummy view over the top and catching events as they come through. This works for mouse down, but again, the mouse dragged is never called. I know that the view can receive the mouse dragged event though, because if I place that view somewhere that a text field isn't under it, everything works fine.
What are my options here? I feel I have tried everything and the only option left is to create a new control from scratch. I don't mind that too much, but I also want the user to be able to add equations in the text field and drag individual values - that means the full functionality of NSTextField will need to be rebuilt just to add this dragging feature... Is there anything else???

mouseOver for NSTableView

I have NSTableView in my application and i have added the hovering effect for the rows by using HoverTableDemo.
I can get the hovering effect only for one row in my table.
It is not apply for the whole table.
How can i get Hovering effect for full table.
Can any body have any idea please revert me.
Take a look: https://stackoverflow.com/a/464828/1758762
You're on the right track with -mouseEntered: and -mouseExited:.
Look into NSView's -addTrackingRect:owner:userData:assumeInside: and -removeTrackingRect: methods.
I can get the hovering effect only for one row in my table.
You can either set up your tableView to create trackingRects for every row that's in there whenever the contents of the tableView change, or alternatively, set up/update one tracking area on the entire tableView whenever -tile or another layout related method is called.

NSOutlineView NSTableRowView Loses Apparent Selection After Editing

I have a view-based outline view (OSX 10.7). Clicking on an item selects it, as usual. Double clicking allows editing of the textfield it contains. However, when I'm done editing the textField, the row's highlight disappears. The outlineView still thinks the row is selected, and sending that row a drawSelectionInRect message doesn't change its appearance. Telling the outlineView to again select the row also doesn't change its appearance. Only by again clicking on the row can I get the highlight to reappear. Any idea what's going on?
My fault. I'm observing changes to the managedObjectContext, and was reloading the entire tree when individual items changed: by correcting this to reload only the affected item, things work as they should.

Weird animations when navigating through views or reloading table view contents

I'm currently working on a MonoTouch application with a NavigationController, a root view with some ImageViews in it and some standard and customized/subclassed TableViews and TableViewCells. Some elements are located in xib files, others are code only.
Navigation and table contents itself work fine. However, I suffer some weird "animation" effects... I'm trying my best to describe them as good as possible.
1)
When navigating back and forth on the navigation stack, each time a view appears, it looks like the items of that view are re-layouted. When navigating from a subview back to the root view, it's ImageViews start off at some location where they shouldn't be and slide to the right location.
2)
TableViewCells "unfold/reveal" their content from top to bottom when appearing in the visible area, even when reloading without animation:
TableView.ReloadSections(new NSIndexSet(1), UITableViewRowAnimation.None);
Scrolling down the table, each cell seems to trigger it's own "unfolding" animation separately as soon as it becomes visible.
3)
Scroll bars of TableViews slide from view to view.
For example, when tapping a cell that pushes another TableView on the stack:
- Parent table slides out to the left / sub-table slides in from the right (as it should)
- When sub-table has fully appeared, it's visible cells "unfold" from top (of the table) to bottom
- Finally, when this weird cell unfolding has finished, the scroll bar slides in from the left (where the parent table "is") to it's correct location on the right side. So it looks like it is reusing the scroll bar of the parent table.
4)
When displaying the network activity indicator...
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
... it appears where the network carrier name is (left-most on the status bar) and slides to it's intended location (next to signal strength indicator). The same happens to the "You are being located" arrow. When starting a LocationManager, the arrow appears on the carrier name and slides to the right.
All this animation and slide action is really irritating and distracting.
I checked on some other MonoTouch apps on the AppStore, none are suffering from this.
What have I done wrong with my application?
I'm really grateful for hints on what might cause this weird behavior and how to disable it.
I had this just today - I'd performed some animations in my app using
UIView.BeginAnimations("AnimationName");
UIView.SetAnimationDuration(0.5f);
// and so on...
and it turns out I hadn't actually committed my animations (using:
UIView.CommitAnimations();
ensuring I had called CommitAnimations() got rid of this behaviour!

How do I check if a NSView is being displayed at the moment?

I got an application which has a NSToolbar in its main window. Depending on which icon is clicked a NSView is displayed in this window. My problem is, that one of these views shows data in a NSTableView that I want to be reloaded each time the view is visible. Since -init is only called once, I don't know how to do that.
(example: When the application starts it shows the Documents section [on of the sub views of the window]. Now when I click on Employees [which displays another sub view instead of the first one] and then on Documents again, I want the data in Documents' NSTableView to reload.)
How do I do that?
Thanks in advance.
I got an application which has a NSToolbar in its main window. Depending on which icon is clicked a NSView is displayed in this window.
Use a tab view. You can hide the tabs, then implement your action methods for the toolbar items to act as the tabs, changing the selected tab view item to whichever one corresponds to the pressed toolbar item.
Now when I click on Employees [which displays another sub view instead of the first one] and then on Documents again, I want the data in Documents' NSTableView to reload.
Why? Why not reload it only when the data changes?
You don't have to hold NSTableView's hand; if it needs the data from you again, it'll ask you for it again.
And if you're concerned about reloading the data while the view is not visible, that's premature optimization. Don't worry about it until you prove via profiling that it is a real performance problem.

Resources