Two NSPopover Center vertical to each other

Hello Friends

How to center vertical two NSPopover with arrow position as shown below in the Image.

Your help is appreciated. Thanks

Images do not show here on the forum. So I need t guess.


NSPopover is positioned relative to its parent view.

So to align vertically, you should for instance:

- have top of both parent views aligned

- slect arrow position at top

- if you want full alignment of NSPopover, theit height should be the same.


EDITED

if the parents windows are not aligned on top, then you need some computation

- get t1 and t2 as the top of parent windows.

- if h1 and h2 are the height of the popovers

- naming m1 and m2 the vertical middle of the popovers

m1 = t1 + space + h1 / 2

m2 = t2 + space + h2 / 2

where space is the little space for the arrow

- then you need to satisfy the following equation

m1 = m2,

which means

t1 + space + h1 / 2 = t2 + space + h2 / 2

so

t1 + h1 / 2 = t2 + h2 / 2

- as t1 and t2 are defined, you need to adapt t1 or / and t2 to fit and set the popovers size accordingly when opening

Two NSPopover Center vertical to each other
 
 
Q