1. (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 )

new topic     » topic index » view message » categorize

2. Re: (Newbie) Using built-in scrollbars

I just sent Rob a small update to my scroller, it's mostly all API but could
give
you some ideas how you might go about what it is your trying to do...
look for it in a day or so on the euphoria user contrib page "name WinAPI5"

Euman
euman at bellsouth.net

> 
> 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 )
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: (Newbie) Using built-in scrollbars

Phil,

I'm not at all sure about this, but maybe you could use   WM_HSCROLL ( 276),
and  WM_VSCROLL ( 277 ) as traps in onEvent?

Dan Moyer

----- Original Message -----
From: <pg_russell at lineone.net>
To: "EUforum" <EUforum at topica.com>
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 )
>
>
>

new topic     » goto parent     » topic index » view message » categorize

4. 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 )
>
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu