Example of scrolling group?

Douglas dougtechie at tiscali.co.uk
Thu Jun 3 20:35:04 EDT 2010


Hi everyone,
I have been struggling for weeks trying to get scrolling working as well.
A while ago, I looked at the example quoted by Trevor below, and thought 
"Easy, - I can do that"
WRONG!
I simply can't get the scroll bars to appear at all reliably, even while 
building the stack in Browse mode in the editor.
I am trying to cover for the user having a smaller screen than my app 
really needs, so automatically shrink the stack to acceptable size after 
checking.
I have tried using a single item in a group as well as with the actual 
group of items that would need to be scrollable.
Most of the time I just get a grey rectangle with nothing in it for both 
H and V bars.
I have tried using lockLocation - doesn't seem to make any difference.
Cut down bits of my code below - anything obviously wrong there?

I also tried the example program:
http://www.runrev.com/developers/lessons-and-tutorials/tutorials/advanced-custom-controls/
And it won't work at all for Vertical bars!
I haven't spent any time trying to debug it yet, but it just does not 
display a vertical bar when selected.
It just keeps the display of a horizontal bar and messes it up!

What is everyone doing wrong? Is it just my OS or Rev version.
I have tried Rev 3.5 and 4.0 both on OSX 10.5.8.
I am just about to try on a Windows PC
I hope someone can point out the obvious thing that I seem to be missing!

Douglas

on checkForScreenSize
    -- this app needs a window 630 wide by 865 approx (PLUS menus and 
Dock if on on OSX!)
    -- globals used gScrHeight, gScrWidth, gWinHeight, gWinWidth, 
gNeedWidth, gNeedHeight
    put 630 into gNeedWidth
    put 865 into gNeedHeight
    put item 3 of the screenRect into gScrWidth
    put item 4 of the screenRect into gScrHeight
if (gScrHeight < 1000) then
   -- shrink the V size of stack to acceptable size for the monitor
    revChangeWindowSize 630,(gScrHeight -150)
    -- do something about scrollbars in here !!!!!!!!!
   SetScrollbarIfNeeded
else
    revChangeWindowSize gNeedWidth,gNeedHeight
    -- ie full size window without scroll bars
end if
put the height of this card into gWinHeight
put the width of this card into gWinWidth
if gScrHeight < 1000 then
       answer error "This system really requires a screen display which 
has at least 1000 pixels vertically." \
& cr &"This screen is "&gScrWidth &"x"&gScrHeight& "."& cr &\
       "It's OK, the window has been shrunk to fit and you will need to 
scroll it to get to all data fields." \
              with "Sorry"
    end if
end checkForScreenSize


on SetScrollbarIfNeeded
   -- Note- this is just the START of this routine - Can't get bars to 
appear and incomplete anyway!
    -- use this to disable/enable Vertical scroll bar if needed for 
window size vs required stack size
    -- using a general group name of PageGroup for group containing 
EVERYTHING on card!

    if (gWinHeight < gNeedHeight  ) then
       set the lockLocation of group "PageGroup" to true  -- does it 
need to be unlocked again later????????
      set the vScrollbar of group "PageGroup" to true
      set the vScroll of group "PageGroup" to 0 -- how-much it appears 
scrolled ( not at all at start!)
      -- Presumably still need to set size of scrollbar and also its offset!
      --(Calculate scrollsize based on amount of visible gWinHeight V 
gNeedHeight)
   else
     set the vScrollbar of group "PageGroup" to false
   end if
end SetScrollbarIfNeeded






On 01/06/2010 13:45, Trevor DeVore wrote:
> On May 29, 2010, at 9:20 PM, Jeff Massung wrote:
>> Anyone have a good example of how to make a group that scrolls (like the
>> data grid)? I haven't seen anything in the User's Guide or on the RunRev
>> site - although I could have missed it.
> This lesson shows how to use a group to scroll large images.
> http://lessons.runrev.com/spaces/lessons/buckets/784/lessons/11788-How-do-I-scroll-a-card-that-is-taller-or-wider-than-the-window- 
>
>



More information about the Use-livecode mailing list