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?
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: Monday, December 20, 2004 2:37 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Scrollbar Issues
Jonathan Eads wrote:
Hello wxPython users,
I need to build a wx.TextCtrl (or something similar) that has
the scrollable region described below:
---------------------------Text To Display-----------------------
Header 1 text line---------------------------
Header 2 text line---------------------------
Header 3 text line---------------------------
Header 4 text line---------------------------
<--Not HScrolled--> <----Horizontally Scrolled---->
----------------------------------------------------------------------
------The headers need to be lined up with each line. The text lines can be
very long and need to be horizontally scrolled independently of the
line headers. The headers and text lines need to scroll vertically
together. Different ranges of the text lines need to be colored
differently and this needs to be a dynamic user triggered event, so it
would save a lot of work if this could be done with something like a
TextCtrl.
There are two ways that I can think to do this:1.) Place text in a TextCtrl and limit the text that can be
horizontally scrolled so that the headers are always available for
each line.---This seems like the easiest approach but I can find no way to
control the size of the region that is horizontally scrolled in
wx.TextCtrl
It can't be done with wx.TextCtrl, it will only scroll the entire client
area.
2.) Load two windows into a splitter window. Perhaps a ListBox for
the
headers and a TextCtrl
for the text lines and sync their vertical scrollbars.
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.
--- I can catch EVT_SCROLLWIN from wx.TextCtrl but I cannot figure out
how to
send scrolling events to a listbox. I tried wx.PostEvent(ListBox, e)
but this did not
Work. Is there a way of registering one scrollbar's events with
another
scrollbar?
Try just calling the otherWindow.ScrollWindow(dx, dy) method.
--
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