Avoiding the focus ring in NSOutline View - objective-c

I have an NSOutlineView which has contextual menu enabled for the selected row. But, when right clicking on any other row other than the selected row, contextual menu is appearing but with a blue focus ring on the clicked row. Tried using drawContextMenuHighlightForRow method, but with right click, even the selected row is also getting de-selected.
How to avoid the focus ring on the clicked row(not selected row) but enable the contextual menu .
Thanks in Advance!!!

Related

Disable following first item of LazyRow sorting

I have LazyRow with animateItemPlacement, items can be moved into the end of list by clicking on a button. Everything is ok with every item except first. Focus (and scroll position) moving with it on button click. How to disable this?
https://streamable.com/bhn85z

How to set the scroll position of the selected element upon reopening ReactSelect menu?

When I open my react-select component with an item already selected, the menu is scrolled upwards with white space of the next item showing at the bottom:
Menu scrolled upwards on open
What I am required to do, however, is to make it look like this, that is, to have my selected item at the very bottom of the menu box:
Menu as I am trying to get it to look on open
Documentation did not help me regarding this particular issue. Is there a way to achieve this, or is this behaviour imposed by react-select?

i am having too many menuitems in menubar. i want to scroll via mouse

I have some menus that contain many menuitems. Mouse wheel doesn't scroll them. I have to use the keyboard arrows or click the arrows at top and bottom. Is it possible to use the mouse wheel to scroll toolstrip menu items? in vb.net Thanks
I have done this by list box because i dint got anything.
i have even use text box so that i can sort my data easily as it has too many menu items
It scrolls easily n get sorted by text box so i can easily find my menu items
thanks.

Is there a way to control the NSMenuItem item that is initially highlighted when opening a menu?

I'm working on the details of a symbols pop up button, similar to what Xcode 3 at the top of its editor window.
My controller object is the delegate of the NSMenu that is shown when the NSPopUpButton is shown. I implement the two methods numberOfItemsInMenu: and menu:updateItem:atIndex:shouldCancel: to populate the menu right before it's about to be displayed.
However, the title and image of the selected NSMenuItem have to change each time the user changes the selection in the editor NSTextView, or makes changes to the text; just as is the case with Xcode.
The problem I'm having is when the user goes to click on the NSPopUpButton to display the NSMenu, the selected NSMenuItem and the item that should be selected do not match up, since the menu doesn't have the proper number of items yet.
I'm wondering if there is a way to control which NSMenuItem is initially highlighted and tracked when the user clicks to open the menu. As it stands, the first item it always highlighted and tracked or, if the user had previously selected a item, that item is highlighted and tracked.
I tried explaining as best I could, but here is a image illustrating my problem:
I want the highlighted item to be the same as the selected item when the user opens the menu. Any ideas?
I would use a NSPopupbutton - it can do what you want. maybe you even hide it?
I am not very sure that I understood your problem but If we can add tags to these menu Items.
e.g.
[mMenuItemOne setTag : 1];
[mMenuItemTwo setTag : 2];
[mMenuItemThree setTag : 3];
[mMenuItemFour setTag : 4];}
we can select any Menu item using
[_popUp selectItemWithTag: _selectedItem];
Just a hint not a full solution.
Try to post an NSMouseMoved event to your app right after the menu shown.
Main problem is here to detect the position of the item you want to be highlighted.
Just a starting point.
Have you tried this NSMenuDelegate method:Handling Highlighting
– menu:willHighlightItem:
NSMenuDelegate Protocol Reference
Also you can store the NSMenuItem index in some var to keep track of the selected item for later use.
I'm not sure, do you want to move the mouse selection highlight (the blue stuff) or the checkmark?
In general, the checkmark is the thing you want to change. You can do so from your validateMenuItem: method (or at any other time if your item is set not to take part in validation) using the -setState: method.
The blue highlight is an indicator of the user's keyboard input or mouse location, and you should not mess with it. Changing it does not make any sense, as it would be changed back the moment the user moves the mouse even a single pixel.
That said, you can set the selectedItem of the NSPopUpButton, which will cause the entire menu to be moved so the selectedItem is under the mouse (assuming the mouse just clicked the popup button).
If your menu delegate method is called after the pop up button has decided what item to select, you can't use it. Instead, you could probably set the selectedItem and menu of the popup button from a NSPopUpButtonWillPopUpNotification handler.
If that is also called too late, you'll probably have to subclass NSPopupButtonCell and do it in an override of -attachPopUpWithFrame:inView: (I think that's the spot that should also work when you don't click and just hit the space key while the popup button is selected).

'Mouse capture' on a scrollbar and popup window in Silverlight 4

I've hit a problem with my OOB silvelight 4 applicatrion.
There is a DataGrid on the page with numer of rows, so that vertical scroll bar appears for the DataGrid.
At times I need to show a child window with a message and OK button.
If before showing the child window I am using the scroll bar, that remains selected after popup is closed. If I move mouse over scroll bar data grid scrolls.
I have tried UpdateLayout, chage visibility, rebind ItemSource. Nothing helps.
Thank you in advance for any idea.
Use the UIElement.ReleaseMouseCapture() method.