After poking around a little, I realized that a TScrollBox responds to WM_VSCROLL and WM_HSCROLL events. Testing it out shows that it does correctly respond to a Magic Mouse, and I assume trackball/trackpad, horizontal scrolls.
This seemed promising and simpler, so I decided to work on this. The problem is that I want the TScrollBox to simply report scroll changes, so I can properly redraw the TPaintBox (I'm scrolling a TGRABitmap following circular's method). Unfortunately a TScrollBox does not have OnChange or OnScroll events.
While it is possible to set TScrollBox.AutoScroll off (since I don't want it to actually scroll the TPaintBox), it still sends OnPaint events, even if the TPaintBox is not a child control. So when I zoom the TPaintBox in code, and try to update the scrollbars it repaints again.
When using a normal TScrollBar I could avoid the call back by setting TScrollBar.OnChange = nil temporarily while updating it, but TScrollBox uses TControlScrollBar which don't have OnChange handlers.
Before I tried this, I also tried implementing these methods following Martin:
TForm1 = class(TForm)
...
procedure WMHScroll(var Msg: TLMScroll); message LM_HSCROLL;
procedure WMVScroll(var Msg: TLMScroll); message LM_VSCROLL;
...
but they never get called. I imagine I am just doing something incorrectly. I hope that all makes sense. Any comments appreciated!
Cheers,
Frederick