Re: Focus ring of NSComboBox and text field visible through overlaid views
Re: Focus ring of NSComboBox and text field visible through overlaid views
- Subject: Re: Focus ring of NSComboBox and text field visible through overlaid views
- From: Navneet Kumar <email@hidden>
- Date: Fri, 30 Jun 2017 20:37:36 +0530
Hi,
Thanks for the reply.
Yes I admit that question was at best vague.
And the last couple of lines of your email says correctly, that I have to float
alerts on top of the rest of the window contents. But not just alerts….
Here is the scenario:
I have the window with a lot of UI elements like a outline view which
highlights rows when mouse hovering and a custom view which has a lot of small
square views as its subviews and each such square has a tooltip. I also have
hover buttons on the window. All these views are in tab view’s tabs, I change
tabs as I progress further when taking input from the user.
Now I have to show not just small alert like views but some elaborate views
having a lot of small elements like that are in the window, on top of the
window. So first I overlap the window by adding a layer-backed transparent view
to self.window.contentView. And then add my top view to this transparent view
as its subview. The transparent view is there just to give a drop shadow to the
top view. Some times depending on app’s processing I also show another top view
(maybe small alert like or maybe a bit more complex) over the current top view.
For this I again add a transparent sub view to window’s contentView and add the
new top view to this transparent view.
So I kind of cascade views.
While this approach was working fine. The focus ring belonging to a combo box
on the window seeped thru to the last top view.
Also the tooltip in small square views on the window are visible even when
covered by overlapping views.
I hope I have been able to describe the problem better now.
I also have a small project uploaded at
http://s000.tinyupload.com/?file_id=49187580361848226909
<http://s000.tinyupload.com/?file_id=49187580361848226909>
Which shows both the focus ring problem and tooltip problem and I have inserted
appropriate comments in the method -
(IBAction)buttonToAddViewsClicked:(id)sender in ViewController.m
I don’t know If I abandon this approach and use sheets, will I be able to put a
sheet over another sheet. OR I just might use separate windows for this, but
this overlapping views thing seems much easier if not for these problems.
I also read in this article which has comments by ex-apple engineers saying
overlapping sibling views (layer-backed or not) are okay since os x 10.5.
link:
https://stackoverflow.com/questions/10720062/are-layer-backed-nsview-siblings-allowed-to-overlap
<https://stackoverflow.com/questions/10720062/are-layer-backed-nsview-siblings-allowed-to-overlap>
Wishes,
Navneet
> On 27-Jun-2017, at 10:56 PM, Quincey Morris
> <email@hidden> wrote:
>
> On Jun 27, 2017, at 06:57 , Navneet Kumar <email@hidden
> <mailto:email@hidden>> wrote:
>>
>> A custom view when overlapped with a transparent view (subview to window’s
>> contentView) and a subview on top of transparent view, also shows the custom
>> cursor and tooltip assigned to the custom view. Even when the custom view’s
>> tracking area is with option NSTrackingActiveInVisibleRect.
>
> This may be the correct behavior. If the overlapping view *doesn’t* have a
> tracking area, there may be nothing to change the cursor back again when it
> enters the overlapping view from the custom view. What happens depends on
> exactly what how you implement setting the cursor, and the behavior can be
> quite subtle and difficult to follow.
>
>> Sadly I got no responses, not even some clue to guide me in the right
>> direction….
>
> I don’t think anyone fully understands your scenario. You refer to the
> various views so vaguely that I can’t keep track. (You’re having trouble with
> a custom view, but your image shows an issue with a combo box. Is that the
> custom view or is something else the custom view? What does "--subview—>”
> mean? Is it a subview relationship, or does it represent an intermediate
> subview in the hierarchy?)
>
> You would need to lay out the exact hierarchy of your window, with the
> geometry of all the views (i.e. how they overlap). That’s not so easy in a
> test message. You could try posting a sample project somewhere, and a few
> people might be prepared to look at it in details.
>
> However, based on the image you posted, it kinda looks like your intention is
> to “float” some kind of alert over the rest of the window contents. If that’s
> what you’re doing, you might have better success if you use a child window
> rather than subviews. Or a sheet.
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden