tags:

views:

62

answers:

1

I want to pop up a window directly beneath the current line (the line with the insertion cursor) in a RichTextCtrl. Is there a way to get the screen coordinate of a specific character or line in the control? There doesn't seem to be, but that's such a glaring omission I figure I must be missing something.

I have lines of varying height so I can't just figure out the line, multiply by line height, and then figure out the offset from the top of the window. What are my options, or am I simply out of luck?

FWIW, I'm using python 2.5 and wxPython 2.8.9.1 (and no ability to upgrade at the moment).

+1  A: 

Hi,

Could you try to test with this function?

wx.richtext.RichTextCtrl.GetCaret().GetPosition()

when I just try that, Its return tuple with probably x, y locations of cursor, in pixel(probably)

Let me know if there is any issue with that.

S.Mark
Thank you, that solved my problem. Combined with self.GetScreenPosition() and caret.GetSize() I'm able to compute the baseline of current line.
Bryan Oakley