Re: (Newbie) Using built-in scrollbars - ta Dan!

new topic     » topic index » view thread      » older message » newer message

Phil,

I hoped you might find the setScrollRange in Win32Lib, but didn't anticipate
you fixing it so it would work right, good job!

You might send the fix to Derek Parnell <ddparnell at bigpond.com>and also to
Martin Stachon <martin.stachon at worldonline.cz>; Derek has been doing most of
the updates for Win32Lib, but may be taking a break(?), and Martin has
recently made some interim updates.

Dan

----- Original Message -----
From: <pg_russell at lineone.net>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, November 04, 2001 3:49 PM
Subject: RE: (Newbie) Using built-in scrollbars - ta Dan!


>
> Dan,
>
> Thanks very much for your amended code - it got me thinking and I have
> now figured out how to alter the scroll ranges as well.
>
> I delved into some win32 documentation and it turned out that you should
> be able to get/set built-in scrollbar attributes with the
> get/setScrollInfo functions.
>
> Looking in win32lib these functions exist but they have not been quite
> correctly implemented for built-in scrollbars. I extracted & fixed the
> relevant code and I attach an amended code sample below which shows the
> built-in scrollbar ranges being altered programmatically.
>
> Do you happen to know who I should send win32lib fix requests to these
> days?
>
> Many thanks to you and everybody else who replied to my original post
>
> Regards,
>
> Phil
>
> -- scroll.exw
> -- Test built-in scrollbars
> -- (displays scrollbar position in window)
> -- Phil Russell Nov 2001
> ---- with slight modification by Dan Moyer
> ---- and further by Phil after inspiration provided above...
>
> without warning
> include win32lib.ew
>
> -- Create window with built-in scrollbars
> constant ScrollWin =
>     create( Window, "ScrollTest", 0, Default, Default, 200, 200,
> WS_SCROLLBARS )
>
>
> -- Modified from win32lib.setScrollRange
> procedure setBuiltInScrollRange( integer window_id, integer scrollbar,
> integer min, integer max )
>
>     -- set the allowable range for a scroll bar
>     atom sif
>     object VOID -- ***duplicated from win32lib
>
>     -- store value ***no access to win32lib private sequence
>     --window_range[ id ] = { min, max }
>
>     -- Allocate structure
>     sif = acquire_mem(0, SIZEOF_SCROLLINFO )
>
>     -- store values
>     store( sif, sifSize, SIZEOF_SCROLLINFO )
>     store( sif, sifMask, SIF_RANGE )
>     store( sif, sifMin, min )
>     store( sif, sifMax, max )
>
>     -- check for valid scrollbar option
>     -- SB_VERT = vertical scrollbar
>     -- SB_HORZ = horizontal scrollbar
>     if scrollbar = SB_VERT or scrollbar = SB_HORZ then
>
> VOID = w32Func( xSetScrollInfo,
>     {   getHandle( window_id ),     -- handle
> scrollbar,                  -- scroll bar to change
> sif,                        -- pointer to structure
> 0 } )                       -- redraw flag
>     end if
>
>     -- Free structure
>     release_mem( sif )
>
> end procedure
>
>
> -- Process scroll event (as amended by Dan Moyer and further by me)
> procedure onScroll_ScrollWin( integer pos)
>
> -- show scrollbar positions
> setPenPosition( ScrollWin, 1, 10 ) -- ADD THIS
> wPuts(ScrollWin, "Horizontal: " & sprint(getHScrollPos( ScrollWin ))) --
> AND THIS
> setPenPosition( ScrollWin, 1, 30 )-- AND THIS
> wPuts(ScrollWin, "Vertical: " & sprint(getVScrollPos( ScrollWin )))
> --AND THIS
>
> end procedure
>
> procedure onOpen_ScrollWin ()
>
> -- *** Fool win32lib into not clipping the scrollbars
> setScrollRange(ScrollWin, 0, 999)
>
> -- *** Alter the scroll ranges
> setBuiltInScrollRange( ScrollWin, SB_VERT, 0, 500 )
> setBuiltInScrollRange( ScrollWin, SB_HORZ, 0, 20 )
>
> end procedure
<snip>

>
>
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu