开发者

EditText's cursor coordinates

开发者 https://www.devze.com 2023-01-21 06:57 出处:网络
As the title sugges开发者_如何学Cts, how can i get the coordinates of the cursor in the EditText ? im not trying to get the cursor position here but the screen coordinates of the cursor.

As the title sugges开发者_如何学Cts, how can i get the coordinates of the cursor in the EditText ? im not trying to get the cursor position here but the screen coordinates of the cursor.

im trying to show a popup relative to that cursor, therefore i need to determine the cursor coordinates first.


You could use (not runnable):

tc = wx.TextCtrl(...)
pop = wx.PopupWindow(...)
x, y = tc.PositionToXY(tc.GetInsertionPoint)
pos = wx.Point(x,y)
pop.Move(pos)

Note that this would include any scrolled distance in the textctrl which you may want to negate (subtract however much you've scrolled from y before creating pos)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号