I have a standard OutlineView on the left pane and Tableview on the right page. The problem is ,when I add a new item to the outlineview using a action, what I want to happen is,
Add an item to the outlineview
Put it in edit mode immediately and give it focus.
When the user had finished editing it, then save the new outline view item to the db.
I can add an new item, but could not put it in the edit mode immediately, any idea how to do it?
Thanks in advance.
Related
I need the ability for a user to press and set an ListView item's checkbox independently of clicking on the item. If they press on the checkbox I will add/remove the checkmark and take some action. If they press on the item text I can take another action.
I can do this with a ListBox no problem with built in functionality. I can't figure out how to do it with a ListView. How is it done?
I can put the following code in the ListView1ItemClickEx to know when the user is clicking on the image. Maybe I can just change the image to a checkmark?
if (ItemObject->Name == "I") {
ShowMessage("Item Image clicked");
}
But I don't know how to change that particular items image (e.g. I could just toggle between a checkmark image and an unchecked image) at runtime.
The picture below is for clarity. Clicking anywhere in the red box will change the items checkbox. For the ListBox clicking anywhere in the blue box will fire the OnClick event and not change the checkbox. I want that same behavior in the ListView.
Ok, Remy answered this related question and it helped me solve this issue. Now I can make the ListView have a checkbox that functions like that of the ListBox. I do it by toggling the item image whenever the user presses (or clicks on) the image area of an item.
When the user clicks an items image I trap it (per Remy's code in the ListView1ItemClickEx event) and toggle it from 0->1 or 1->0 in a vector at reference ItemIndex (e.g. myVector[ItemIndex] = 0) and then I completely rebuild the ListView (clear it and build from scratch).
I thought I'd have to remember where in the list I had scrolled down to and after refreshing the ListView I'd have to scroll to that point in code - but, that isn't the case. I don't know why but after the refresh I'm still at the point in the list where I clicked an item image. It makes it work and feel exactly like a check box.
It works great in iOS, Android, and Windows.
p.s. I forgot to mention that you need to treat any Header's like they are items in your vector that keeps up with each items' image (0 or 1). Otherwise adding headers gets you out of sync and clicking an item's image will toggle some other item's image.
I have NSOutlineView and I don't know how to disable unselect row in it. It's problem when I click into NSOutlineView where isn't any cell, selected row is unselected. Is there any way, how to keep selected row when someone click into NSOutlineView? But It has to work normally when someone click onto other cell. Thanks.
In Interface Builder go to the Attribute inspector, under the Table View section make sure Empty is not checked.
I have a UIlabel that is added dynamically to a view.
What i want is a small delete button (custom image I have) to be added
to the top right corner of the label which should basically delete the label when clicked.
Can someone get me started with what kind of trick can be used to achieve this?
Infact I am open to using any other control in place of label.
Thanks a lot in advance,
Prasad.
Just make a button and then when the button is pressed:
- (IBAction)deleteLabelPressed:(id)sender {
[self.labelText setHidden:YES];
}
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.
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.