I found this procedure to scroll the control the mouse is over when using
the mouse wheel, not just the focused control.

 

procedure TMainForm.MouseWheelHandler(var Message: TMessage);

var

  Control: TWinControl;

begin

  Control := FindVCLWindow(Mouse.CursorPos);

  if Assigned(Control) and (Control <> ActiveControl) then

  with Message do

  begin

    Result := Control.Perform(CM_MOUSEWHEEL, WParam, LParam);

    if Result = 0 then Control.DefaultHandler(Message)

  end

  else inherited MouseWheelHandler(Message);

end;

 

This works well when the mouse is over a control that supports scrolling,
but crashes in the TWinControl.DefaultHandler procedure at CallWindowProc,
when over other controls.  I'm not sure how to prevent this error.  Even a
try/except to ignore the error doesn't work.  Any ideas?

 

Cheers,
Ross.

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

Reply via email to