Questions on scrolling FormViews, etc.
wirth at almaden.ibm.com
wirth at almaden.ibm.com
Tue Dec 8 02:45:15 UTC 1998
Hey, this is fun. I'm finally getting around to writing some Squeak code
for some visual UI experiments I've been threatening to do for ages. But I
have a few questions for the group. Here's what I want to do:
Goal: I have a large image/drawing (larger than screen size) that I want
to pan around and overlay with some alpha-blended annotations. I want to
present it in a window and scroll by using scroll bars and (for extra
credit :-) by using a "hand grabber" (as in Adobe Illustrator).
Currently, (using MVC :-) I've created a TestView class, descending from
ColorSystemView, into which I put a FormView, which contains the Form
holding (a portion of) my image. Using the Form object, I can do the
annotations I want (copying shamelessly from the BitBlt alphaBlendDemo
code). But I need to do more:
1. Presuming my image will fit in a Form which I can hold in memory, how do
I scroll this large Form around in a smaller viewport? There are scrolling
view classes for lists, etc., but I haven't found anything I can use for a
Form. Do I need to build my own, basing it on scrolling lists, for
example? Can I just embed a FormView in a scrolling list? Are there some
transformation settings on a FormView that I can use? (By default, if I
put a larger Form into a smaller FormView>>ColorSystemView, the Form gets
scaled to fit, not clipped.)
2. (This question is probably for Sam Adams) If I succeed in creating a
scrolling view of my Form, with scrollbars, what do I need to do to insure
that Windoze-style scrollbars will work with it?
2. At the end of my current "alphaBlending into a Form" I do a "myView
topView model changed" in order to get update messages sent to all the
subviews and refresh the display. This does indeed cause my window to come
to the top, and the displayed graphics to be updated with my alphablended
content. But when I click on the window to make it "active" (so the title
bar gets emphasized), the old window contents reappears! (Where did it
come from? See next question.) Minimizing the window and reexpanding it
shows the new contents. What is causing this behavior?
3. I've setup a release method on my window that causes any persistent
references to it and its parts (by my objects) to be set to nil. But I'm
losing about 1 MB of available memory every time I create/open/close a
TestView (suspiciously similar in size to the Form I'm creating). I can't
think of anywhere I might still have a reference to any of these objects.
But something's not getting GC'd. Any ideas? Is there some caching in
Display that might be causing the problem?
4. In order to avoid visual refresh glitches, I'll probably double-buffer
the final image, i.e., do my graphic manipulations in the large, off-screen
Form, BitBlt'ing pieces of it to the displayed Form. Maybe this is the way
to handle scrolling, too. Comments? Any pre-existing code I should look
5. OK, already. I should really be using Morphic. Right? Any hints? Can
I get the performance I need to support smooth scrolling and "hand grabber"
Thanks in advance. Having fun in Silicon Valley,
More information about the Squeak-dev