I found a wonderful hack of a solution. Two custom wx.stc
windows loaded into a splitter. One holds the headers the other holds
the lines. When I vertically scroll the wx.stc holding the lines I
capture all scrolling events and window sizing events and calculate the
total lines visible and display only those headers in the wx.stc
displaying headers. The visual effect is exactly what I want, from left
to right what is displayed is the headers with no vertical scrollbar,
the splitter, and then the associated lines with vertical and horizontal
scrollbar. It gives the allusion of automatic scrolling with all of the
really cool features of wx.stc which are going to come in very handy.
One slight issue, I have implemented zooming using the wx.stc
GetZoom()and SetZoom() members. When I call LinesOnScreen() after
zooming the number of lines is not correct, it is often less then what
is displayed, this causes issues with the display of the line headers.
I found that a simple resizing of the window corrects the problem.
Yet another hack, what I would like to do is automatically fire
of a wx.EVT_SIZE to the window after scrolling, this seems to cause
LinesOnScreen() to return the correct number, and the handler for
wx.EVT_SIZE I installed to draw the correct set of headers. I have
looked at the wx docs for creating and sending events but am a bit
confused.... An even better solution would of course be getting
LinesOnScreen() to adjust appropriately with zooming but I fear this
will be out of reach.
Jeads
···
Jonathan Eads
Bioinformatics Programmer III
Diversa Corporation
4955 Directors Place
San Diego, CA 92121
Phone: (858)526-5398
Email: jeads@diversa.com
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Thursday, December 23, 2004 4:25 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Scrollbar Issues
Jonathan Eads wrote:
Robin,
You will probably have alignment issues with this, as the spacing
between lines may not be the same in the two kinds of controls. Your
best bet for using existing controls is to use two wx.TextCtrls.
Another possibility is to create a custom control that does it's own
painting and scrolling how you want it.Do you have any advice for building a
custom control? The wx.TextCtrl is not going to work for what I want.
I have started working on a custom SplitterWindow that holds two
ScrolledWindows, one for the headers and one for the lines of text. I
have been using a BufferedDC with DrawText() to draw the text on an
EmptyBitmap.
Some of the lines of text are very long, requiring very large bitmaps.
I can reduce the size of the bitmap by drawing only what is displayed
in the window but that is going to be relatively painful with
scrolling and resizing.
Is there something better to draw text on other then a bitmap, less
memory intensive?
Other than drawing directly to the window, No.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org