(Newbie) Using built-in scrollbars

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

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu