Re: (Newbie) Using built-in scrollbars
Phil,
For something that turned out to be real simple, this was quite a struggle
for me!
Here's a very slight modification of your original code, which will give you
horiz & vert scroll bar info from your window as you created it:
-- scroll.exw
-- Test built-in scrollbars
-- (displays scrollbar position in window)
-- Phil Russell Nov 2001
---- with slight modification by Dan Moyer
without warning
include win32lib.ew
-- Create window with built-in scrollbars
constant ScrollWin =
create( Window, "ScrollTest", 0, Default, Default, 200, 200,
WS_SCROLLBARS )
-- Action to take when the window opens
procedure onScroll_ScrollWin( integer pos)
-- we only get the position, not the scrollbar!!!
repaintWindow( ScrollWin )
-- DO THE FOLLOWING TO GET HORIZ AND VERT INFO:
--wPuts( ScrollWin, sprint(pos) ) -- ELIMINATE THIS
setPenPosition( ScrollWin, 1, 10 ) -- ADD THIS
wPuts(ScrollWin, sprint(getHScrollPos( ScrollWin ))) -- AND THIS
setPenPosition( ScrollWin, 1, 30 )-- AND THIS
wPuts(ScrollWin, sprint(getVScrollPos( ScrollWin ))) --AND THIS
end procedure
-- Trap scroll event
onScroll[ScrollWin] = routine_id("onScroll_ScrollWin")
-- Hand control over to Windows
WinMain( ScrollWin, Normal )
----- Original Message -----
From: <pg_russell at lineone.net>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, November 01, 2001 11:26 AM
Subject: (Newbie) Using built-in scrollbars
>
> Dear All,
>
> I have a win32lib-based program which requires a window with both
> vertical & horizontal scrollbars. Being a lazy type I would rather use
> the built-in scrollbars in my window (i.e. created with the
> WS_SCROLLBARS attribute) than code them as separate controls.
>
> However, trapping the onScroll event in this case just gives me the
> scrollbar position *without* identifying which scrollbar it relates to,
> which is not much use. In addition I would like to be able to change
> the scrollbar ranges in the same way as one can with the standard
> scrollbar controls. (test code demonstrating the problem is at the end
> of this post)
>
> Does anyone know if what I am trying to do is possible? And if so how to
> do it?
>
> I would be very grateful for any feedback. Apologies in advance if this
> is a newbie howler.
>
> Regards
>
> Phil Russell
>
> -- scroll.exw
> -- Test built-in scrollbars
> -- (displays scrollbar position in window)
> -- Phil Russell Nov 2001
>
> without warning
> include win32lib.ew
>
> -- Create window with built-in scrollbars
> constant ScrollWin =
> create( Window, "ScrollTest", 0, Default, Default, 200, 200,
> WS_SCROLLBARS )
>
> -- Action to take when the window opens
> procedure onScroll_ScrollWin( integer pos)
>
> -- we only get the position, not the scrollbar!!!
> repaintWindow( ScrollWin )
> wPuts( ScrollWin, sprint(pos) )
>
> end procedure
>
> -- Trap scroll event
> onScroll[ScrollWin] = routine_id("onScroll_ScrollWin")
>
> -- Hand control over to Windows
> WinMain( ScrollWin, Normal )
>
>
>
|
Not Categorized, Please Help
|
|