{ import: Scroll } { import: Frame } { include "SDL/SDL.h" } "Quick hack" PluggableDraggingHandler : DraggingHandler (motionBlock) PluggableDraggingHandler motionBlock: aBlock [ motionBlock := aBlock ] PluggableDraggingHandler motion :anEvent [ motionBlock value: anEvent value: anEvent position - reference. box damaged ] [ | window yBar box pane1 pane2 image frame | window := Window new: 1000, 800. pane1 := ScrollPane new. window add: pane1. image := ImageBox newImage: (SDLImage fromBMP: 'alto.bmp'). pane1 add: image. pane1 position: 30, 30. image buttonDown: ((PluggableDraggingHandler with: image) motionBlock: [:anEvent :position | pane1 scroll: position]). yBar := VScrollBar new. yBar extent: 20, pane1 height. yBar position: pane1 position + (pane1 width + 30, 0). yBar model inner: (30 size: 10) outer: (30 size: 420). window add: yBar. box := Box new. box background: ColorRed. box extent: 20, 20. window addFront: box. yBar model when: #changed do: [ :adj | box damaged; position: box position x, adj value; damaged ]. box buttonDown: ((PluggableDraggingHandler with: box) motionBlock: [:anEvent :position | box damaged. box position: position. yBar model value: position y. box damaged]). pane2 := ScrollPane new. frame := FrameBox with: pane2 title: 'Picture'. image := ImageBox newImage: (SDLImage fromBMP: 'alto.bmp'). pane2 add: image. image buttonDown: ((PluggableDraggingHandler with: image) motionBlock: [:anEvent :position | pane2 scroll: position]). window add: frame. frame position: pane1 position x, (pane1 position y + pane1 extent y + 30). window mainLoop. ]