import "ecere" class SlidingPanel : Window { bool dragging; Point startScroll, startDrag; bool OnCreate() { group.size = { scrollArea.w - 20, scrollArea.h - 20 }; return true; } Window group { this, clickThrough = true, opacity = 0, position = { 10, 10 }, borderStyle = deepContour }; bool OnRightButtonDown(int x, int y, Modifiers mods) { startScroll = scroll; startDrag = { x, y }; dragging = true; //Capture(); return true; } bool OnRightButtonUp(int x, int y, Modifiers mods) { if(dragging) { dragging = false; ReleaseCapture(); } return true; } bool OnMouseMove(int x, int y, Modifiers mods) { if(dragging) { scroll = { Max(0, Min(scrollArea.w, startScroll.x - (x - startDrag.x))), Max(0, Min(scrollArea.h, startScroll.y - (y - startDrag.y))) }; // To cause children to reposition... size = size; } return true; } } class MyButton : Button { clickThrough = true; } class Form1 : SlidingPanel { caption = "Form1"; background = activeBorder; borderStyle = sizable; hasMaximize = true; hasMinimize = true; hasClose = true; clientSize = { 616, 422 }; scrollArea = { 1024, 1024 }; position = { 696, 296 }; MyButton button1 { this, caption = "button1", position = { 156, 284 } }; MyButton button2 { this, caption = "button2", position = { 500, 88 } }; MyButton button3 { this, caption = "button3", position = { 316, 324 } }; } Form1 form1 {};