The documentation for wxpython indicates that generic widnow behaviour
includes scrolling, but I've been unable to find a good example that shows
how to do it.
I have data organized in frames and want to scroll through a bunch of frames
in a window. I've found one implementation that implements scrolling by
creating as many frames as the window will hold and updating the data in the
visible frames with data each time the window is scrolled, but this doesn't
seem very satisfying. Its not true scrolling
I think what I want to do is create a pane, put as much into the pane as is
needed even if not all of it is visible. As soon as it gets larger than a
page, the scroll bars should start working.
The documentation for wxpython indicates that generic widnow behaviour
includes scrolling, but I've been unable to find a good example that shows
how to do it.
I have data organized in frames and want to scroll through a bunch of
frames
in a window. I've found one implementation that implements scrolling by
creating as many frames as the window will hold and updating the data in
the
visible frames with data each time the window is scrolled, but this
doesn't
seem very satisfying. Its not true scrolling
I think what I want to do is create a pane, put as much into the pane as
is
needed even if not all of it is visible. As soon as it gets larger than a
page, the scroll bars should start working.
Sounds like a UI nightmare (if I understand what you are doing I'd probably
just use a wxNotebook page for each "frame") but to answer your question you
can activate the built-in scrollbar by using the wxVSCROLL and/or wxHSCROLL
flags on the window, and SetScrollbar to set the range and etc. Then you
just need to respond to the EVT_SCROLL_* events.
Sounds like a UI nightmare (if I understand what you are doing I'd probably
just use a wxNotebook page for each "frame") but to answer your question you
can activate the built-in scrollbar by using the wxVSCROLL and/or wxHSCROLL
flags on the window, and SetScrollbar to set the range and etc. Then you
just need to respond to the EVT_SCROLL_* events.
Hmm. first of all, some terminology: In wx parlance, a "frame" is a top
level window, that is managed by the window manager (with a title bar,
etc.). I don't think that's what you mean. So you might mean a wxPanel,
ot maybe you just mean a rectangular box drawn with some controls on it.
If you give us a more detailed description, we might be able to come up
with a nifty suggestion (I like Robin's Notebook idea).
In the meantime, take a look at wxScrolledWindow, it might be jsut what
you are looking for.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Could be. But what I want to do seems "reasonable" to me.
What I have in mind is something like what you can see in an accounting
application like Quicken with one widget container per transaction. Each
widget container has several items of text data. There can be thousands of
transactions. Quicken does this quite nicely using whatever windowing system
its running on, scrolling them contains up and down as needed. I think you
can show part of a container.
I don't think I'd want thousands of notebook tabs, one per 'transaction'
I tried the wxScrolled window, but as I added panels directly to the
ScrolledWindow widget, they appeared to extend the size of the scrolled
window beyond the bottom of the Frame. I wanted the scrolled window to fill
until it ran out of room and then activate scrolling.
I may be misunderstanding how scrolling works in wx. It seems like the thing
to be scrolled through has to be a separate widget from the Window that's
doing the scrolling, and there has to be something that calculates on the fly
what portion of the scrolled thing to actually display and then displays it
in response to the scroll event.
Is that what's going on? Where should the panels to be scrolled through be
attached? What's the mechanism for selecting the subset to be displayed in
the scrolledWindow?
The only example I've been able to find is related to graphics. Is
programming for scrollbars covered in detail anywhere for wx. I'm looking
for something that ties it together, including how to program with device
context if that's necessary.
The specific thing I need to learn is exactly what choices of wxObjects are
available to do the job and how to configure the scrolling mechanism
appropriately for them.
-Pat
P.S. Sorry about the confusion over the term "Frame", I just arrived from
Tkinter where a Frame seems to me to be about the same thing as a Panel in wx.
> Robin Dunn wrote:
> > Sounds like a UI nightmare
Could be. But what I want to do seems "reasonable" to me.
What I have in mind is something like what you can see in an accounting
application like Quicken with one widget container per transaction. Each
widget container has several items of text data. There can be thousands
of
transactions. Quicken does this quite nicely using whatever windowing
system
its running on, scrolling them contains up and down as needed. I think
you
can show part of a container.
But Quicken doesn't actually do what you are attempting, it just looks like
it. In my (somewhat old) version doesn't use widgets/controls for every
item in the register, it just draws facsimiles of them and the values on a
scrollable window. When you click on one of these entry areas then the
actual widget is created and shown in the same area.
I don't think I'd want thousands of notebook tabs, one per 'transaction'
And you wouldn't want thousands of panels with several controls each either.
The overhead would be icky.
You may want to do something like the above, or just create enough panels to
fill your window and then replace values in them as you get scroll events to
simulate actual scrolling.
I tried the wxScrolled window, but as I added panels directly to the
ScrolledWindow widget, they appeared to extend the size of the scrolled
window beyond the bottom of the Frame. I wanted the scrolled window to
fill
until it ran out of room and then activate scrolling.
Sounds like you didn't call SetScrollbars, which sets the "virtual size" of
the scrolled window.