I have a tool which searches a set of files for a regex and displays the results. The full contents of each file are displayed in a set of ExpandoTextCtrls (one for each file) stacked on top of each other. The regex matches are highlighted. This stack of text controls is contained by a sizer in a ScrolledPanel. Now what I want to do is make it so that when I hit a key, the next match will be scrolled into view. I believe this would involve two steps: 1) The ScrolledPanel needs to scroll to the appropriate text control, 2) The text control would need to be scrolled to show the position at the start of the match. I’ve had a lot of trouble understanding the scrolling methods for the text control. Is there some easy way to do this that I’m overlooking?
Wait, scratch the part about needing to scroll the text controls. Since I’m using the ExpandoTextCtrl, of course I don’t need to scroll the text control. I really just need to go from a position to a point in a text control and then get the ScrolledPanel to scroll to that point.
···
On Sun, Jun 8, 2008 at 8:35 PM, Jesse Aldridge jessealdridge@gmail.com wrote:
I have a tool which searches a set of files for a regex and displays the results. The full contents of each file are displayed in a set of ExpandoTextCtrls (one for each file) stacked on top of each other. The regex matches are highlighted. This stack of text controls is contained by a sizer in a ScrolledPanel. Now what I want to do is make it so that when I hit a key, the next match will be scrolled into view. I believe this would involve two steps: 1) The ScrolledPanel needs to scroll to the appropriate text control, 2) The text control would need to be scrolled to show the position at the start of the match. I’ve had a lot of trouble understanding the scrolling methods for the text control. Is there some easy way to do this that I’m overlooking?
Jesse Aldridge wrote:
Wait, scratch the part about needing to scroll the text controls. Since I'm using the ExpandoTextCtrl, of course I don't need to scroll the text control. I really just need to go from a position to a point in a text control and then get the ScrolledPanel to scroll to that point.
Unfortunately wx.TextCtrl doesn't give us the ability to get pixel positions from a text position.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!