Why does a "Save" screw up the "scroll" settings?
Ray Bennett
smilingeyes at mac.com
Sat Jan 18 16:57:02 EST 2003
Hi Kurt,
I'm a relatively green Revolutionary, but am pretty "long in the tooth"
in HyperCard (alas, since abandoned because I need to build software I
can sell!). This is a lengthy reply, but hopefully will either help us
both or get someone else to jump in the thread.
Anyway, I've been futzing around with this scrolling situation a little
more today. Here are the specifics and below is a scrollbar handler
for the scrollbar I used on the card. I won't include the card here
only because what I'm doing is somewhat proprietary.
The background (large group with background behavior set to "true")
contains lots of graphics (mostly lines) and a few fields. The height
property of this group is 1724. The top of this group is at -10 (i
think this doesn't mean a lot, until you start printing stuff, then you
need to pay attention to it).
There is another group on the card with lots of fields (170) whose
values change on each card; it is 1661 high. Its top is at 10 (the
-10, 10 reflects the positioning needed for the graphics to properly
layer under the active fields - I'm just too lazy to go back and fix
it).
My card window is set (by the preopencard handler) to 695w x 880h. I
use a scrollbar control (named "rbscrollbar") on the left hand side of
the card. I make it invisible when I print the card, and visible when
I'm done printing. I have two handlers for printing the card - one for
the top half, one for the bottom half. Getting things to print
successfully was a non-trivial exercise, but based on a couple of
Sarah's responses to previous printing questions, I finally figured it
out. (you have to dork around with the "into" printrect and probably
have to lie about your left (in portrait) or top (in landscape)
starting point. {if these would be helpful to you, shoot me an email
and I'll send them on}
I'd originally had handlers for most of the scrollbar messages, but
realized that for my purposes, the scrollbarDrag message was adequate,
and is always sent when there weren't any handlers for the others
(scrollbarLineInc, scrollbarLineDec,...PageInc,...PageDec).
So, with that lengthy introduction, here is the little bit of scrollbar
code. It works perfectly. The only problem I ever have is when I
"save". If I'm not at the top, I get basically graphical soup on my
screen (until, of course, I move the scrollbar a touch - that fixes
everything).
--The handler for scrollbar "rbscrollbar"
on scrollbarDrag newPosition
-- startvalue is set to 0
-- endvalue is set to 1300, note, even though the card is higher,
this is all the "scroll" we need
put newPosition into myNewPosition --serves no purpose now, I used to
manipulate it.
set the scroll of group "32ManBackground" to myNewPosition --the bg
group
set the scroll of group "32_Normal_ActiveGroup" to myNewPosition
--the "active" group
set the top of scrollbar "rbscrollbar" to 0 -- probably no longer
necessary, but i haven't tried without it.
--
if the thumbPosition of me is 0 then
set the top of bg "32_Normal_ActiveGroup" to 10
set the top of bg "32ManBackground" to -10
end if
-- these little beauties allow you to maintain the same scroll height
on every card with the same bg
set the _32BackScroll of this stack to the scroll of group
"32ManBackground"
set the _32ActiveScroll of this stack to the scroll of group
"32_Normal_ActiveGroup"
set the _32Thumb of this stack to the thumbPosition of scrollbar
"rbscrollbar"
end scrollbarDrag
Hopefully, this long-winded-ness wasn't just a waste of everyone's time.
Ray
>
On Saturday, Jan 18, 2003, at 21:04 America/New_York, Kurt Kaufman
wrote:
> I have also experienced strange goings-on (images whose position
> suddenly jumps way off screen, sudden appearance of images as gray
> rectangles, etc.), when I try to set up a window with scrolling
> contents, though I'm *not* sure that I'm doing it correctly. I'd be
> interested in viewing the scripts of a project where this has been
> successfully implemented. -That would reassure me greatly!
>
> -Kurt
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list