textctrl.PositionToXy

17 views
Skip to first unread message

Nathan smith

unread,
Feb 16, 2022, 7:07:07 PM2/16/22
to wxpytho...@googlegroups.com
Hi there,


could someone give me a quick rundown of what textCtrl.PositionToXy
actually does?

According to the documentation it returns a 0 based line position and
column number, which I would assume to mean,:

PositionToXy(t1.GetInsertionPoint())

would return (x, y) where y is the line number in the widget and x is
the character count from left to right.


bug first off it returns (Bool, X, Y). What is that bool for?


And second off I have a texCtrl that is returning 318 when it only has
169 lines in it.


thanks in Advance,

Nathan

Tim Roberts

unread,
Feb 17, 2022, 1:32:51 AM2/17/22
to wxpytho...@googlegroups.com
On 2/16/22 16:06, Nathan smith wrote:

>
> could someone give me a quick rundown of what textCtrl.PositionToXy
> actually does?
>
> According to the documentation it returns a 0 based line position and
> column number, which I would assume to mean,:
> PositionToXy(t1.GetInsertionPoint())
> would return (x, y) where y is the line number in the widget and x is
> the character count from left to right.

That's the theory, yes.


> bug first off it returns (Bool, X, Y). What is that bool for?

Success or failure.  You can look at the wxWidgets C++ reference for
that.  It only fails if the incoming position is way too large.


> And second off I have a texCtrl that is returning 318 when it only has
> 169 lines in it.

Interesting.  Does it return a reasonable X?  What was the
GetInsertionPoint value?

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Nathan smith

unread,
Feb 17, 2022, 5:55:57 AM2/17/22
to wxpytho...@googlegroups.com
Hi tim,


Thanks for that, I admit I rarely look at the c++ docs as I don't really
know the language that well other than knowing the rough syntax so it
didn't even cross my mind.


Re the weird line number, I suspect I figured out what it is.

I think it's employing its own wrapping, rather than counting "\n" where
as I was looking for counting "\n"'s.


Nathan
Reply all
Reply to author
Forward
0 new messages