开发者

EditText's cursor coordinates

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜