Popover location coordinates for button in table row
I’m trying to present a popover triggered by a button in a TableViewCell.
My underlying table is a TreeNode (from File Picker) and so I can’t use row_height * row index calculation.
Converting button.center to screen_coordinates is where I’m getting stuck (I think this is how to accomplish the task)
def b_action(sender): vi = ObjCInstance(b).view() r = vi.convertRect_toView_(vi.bounds(),None) # x,y in screen coordinates, not in view x,y,w,h = r.origin.x,r.origin.y,r.size.width,r.size.height po = ui.View() po.frame = (0,0,200,200) po.present('popover',popover_location=(x+w/2,y+h))
Thank you again for saving my project (and sanity)
I had read that thread before, but didn’t make the connection.
Here’s what worked for me:
I ended up using
vi = ObjCInstance(b)
Since my object ‘b’ is ui.Button
I appreciate how helpful this community is. I’m learning a lot.
@crazyfox, for future reference, note the convenient