Is there anyway to store and then restore the scrolled to position in a wxTextCtrl? Not the HTML one, but just the text one.
Something like STC’s GetFirstVisibleLine, but for wxTextCtrl?
Thanks.
–Josh
···
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
Is there anyway to store and then restore the scrolled to position in a
wxTextCtrl? Not the HTML one, but just the text one.
See if this will help you:
http://wxwidgets.org/manuals/2.6.3/wx_wxtextctrl.html#wxtextctrlshowposition
Ricardo
Is there anyway to store and then restore the scrolled to position in a
wxTextCtrl? Not the HTML one, but just the text one.
See if this will help you:
http://wxwidgets.org/manuals/2.6.3/wx_wxtextctrl.html#wxtextctrlshowposition
Yeah, that’s the function I would use if I had pos, but I don’t and that’s the problem. Is there a way to see which pos is
in the upper left corner? The position would be preferable, but I might
be able to make do with the line. Or maybe even the scrolled amount.
But I don’t know that you can correctly manually scroll a TextCtrl.
Any ideas on how to get the proper pos?
–Josh
···
On 5/9/06, Ricardo Pedroso ricardo.pedroso@netvisao.pt wrote:
Ricardo
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
So no GetFirstVisibleLine type command for TextCtrl? Isn’t there some way to just grab the first line from the windows, etc?
Anyone?
–Josh
···
On 5/9/06, Josh Menke josh@cs.byu.edu wrote:
On 5/9/06, Ricardo Pedroso <ricardo.pedroso@netvisao.pt > > wrote:
Is there anyway to store and then restore the scrolled to position in a
wxTextCtrl? Not the HTML one, but just the text one.
See if this will help you:
[
wxTextCtrl](wxTextCtrl)
Yeah, that’s the function I would use if I had pos, but I don’t and that’s the problem. Is there a way to see which pos is
in the upper left corner? The position would be preferable, but I might
be able to make do with the line. Or maybe even the scrolled amount.
But I don’t know that you can correctly manually scroll a TextCtrl.
Any ideas on how to get the proper pos?
–Josh
Ricardo
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
OK, just to partly answer my own question.
I did the following:
scroll = self.GetScrolledPos(wx.VERTICAL)
This gets me the scrolled position in pixels, I believe. I then, by
trial-and-error, found that the number of pixels in one LINE of
scrolling is 19.
So then I did:
self.ScrollLines(scroll/19)
Is there a surefire way to get the exact height of a scroll line in pixels? Seems like there should be, based on the font, etc.
How do you get the height of a scroll line in pixels?
–Josh
···
On 5/10/06, Josh Menke josh@cs.byu.edu wrote:
So no GetFirstVisibleLine type command for TextCtrl? Isn’t there some way to just grab the first line from the windows, etc?
Anyone?
–Josh
On 5/9/06, Josh Menke < > josh@cs.byu.edu> wrote:
On 5/9/06, Ricardo Pedroso <ricardo.pedroso@netvisao.pt > > > wrote:
Is there anyway to store and then restore the scrolled to position in a
wxTextCtrl? Not the HTML one, but just the text one.
See if this will help you:
[
wxTextCtrl](wxTextCtrl)
Yeah, that’s the function I would use if I had pos, but I don’t and that’s the problem. Is there a way to see which pos is
in the upper left corner? The position would be preferable, but I might
be able to make do with the line. Or maybe even the scrolled amount.
But I don’t know that you can correctly manually scroll a TextCtrl.
Any ideas on how to get the proper pos?
–Josh
Ricardo
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
Hello Josh,
you can try something like:
linewidth, lineheight = MyTextCtrl.GetTextExtent(“Aq”)
Then you can use the lineheight result to see if it is closer to 19 or not.
HTH.
Andrea.
OK, just to partly answer my own question.
I did the following:
scroll = self.GetScrolledPos(wx.VERTICAL)
This gets me the scrolled position in pixels, I believe. I then, by
trial-and-error, found that the number of pixels in one LINE of scrolling is
19.
So then I did:
self.ScrollLines(scroll/19)
Is there a surefire way to get the exact height of a scroll line in pixels?
Seems like there should be, based on the font, etc.
How do you get the height of a scroll line in pixels?
–Josh
So no GetFirstVisibleLine type command for TextCtrl? Isn’t there some way
to just grab the first line from the windows, etc?
Anyone?
–Josh
Is there anyway to store and then restore the scrolled to position
in a
wxTextCtrl? Not the HTML one, but just the text one.
See if this will help you:
http://wxwidgets.org/manuals/2.6.3/wx_wxtextctrl.html#wxtextctrlshowposition
···
On 5/11/06, Josh Menke josh@cs.byu.edu wrote:
On 5/10/06, Josh Menke josh@cs.byu.edu wrote:
On 5/9/06, Josh Menke < josh@cs.byu.edu> wrote:
On 5/9/06, Ricardo Pedroso < ricardo.pedroso@netvisao.pt > wrote:
Yeah, that’s the function I would use if I had pos, but I don’t and
that’s the problem. Is there a way to see which pos is in the upper left
corner? The position would be preferable, but I might be able to make do
with the line. Or maybe even the scrolled amount. But I don’t know that you
can correctly manually scroll a TextCtrl.
Any ideas on how to get the proper pos?
–Josh
Ricardo
To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
–
“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.virgilio.it/infinity77/
So no GetFirstVisibleLine type command for TextCtrl? Isn't there some way
to
just grab the first line from the windows, etc?
Maybe this can do the job:
def GetFirstVisibleLine(self):
res, col, row = self.txt.HitTest((0,0))
pos = self.txt.XYToPosition(col,row) + 1
self.txt.ShowPosition(pos)
Ricardo
Maybe this can do the job:
def GetFirstVisibleLine(self):
res, col, row = self.txt.HitTest((0,0))
pos = self.txt.XYToPosition(col,row) + 1
self.txt.ShowPosition(pos)
Oh, you were close. I remembered that HitTest returns the row and
column for the text and is not in pixels for TextCtrl. So, the answer
is:
def GetFirstVisibleLine(self):
res, col, row = self.txt.HitTest((0,0))
return res+row
It’s res+row instead of just row because both no scrolling and one
scroll makes row = 0, whereas res = 1 after the first scroll. Kind of
odd but it works.
–Josh
···
On 5/11/06, Ricardo Pedroso ricardo.pedroso@netvisao.pt wrote:
Ricardo
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu
Thanks Andrea, I’ll hold on to this for future reference if I have problems with HitTest(0,0).
–Josh
···
On 5/11/06, Andrea Gavana andrea.gavana@gmail.com wrote:
you can try something like:
linewidth, lineheight = MyTextCtrl.GetTextExtent(“Aq”)
Then you can use the lineheight result to see if it is closer to 19 or not.
–
Joshua Menke
NNML Lab
BYU CS
josh@cs.byu.edu