Ver Mensaje Individual
  #5  
Antiguo 13-10-2011
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Felipe.

En otra prueba me dí cuenta que el código anterior dejaba fuera al TForm por ejemplo.

De este modo queda contemplado:
Código Delphi [-]
procedure TForm1.MouseWheel(var Msg: tagMSG; var Handled: Boolean);
var
  i: SmallInt;
  FControl: TWinControl;
begin
  FControl:= FindVCLWindow(Mouse.CursorPos);
  if Msg.message = WM_MOUSEWHEEL then
  begin
    if (GetWindowLong(FControl.Handle, GWL_STYLE) and WS_VSCROLL <> 0) then //  Scroll vertical presente ?
    begin
      Msg.message := WM_KEYDOWN;
      Msg.lParam := 0;
      i:= HiWord(Msg.wParam);
      if (FControl is TScrollingWinControl) then // ScrollBoxBox, Form,...
      begin
        with TScrollingWinControl(FControl).VertScrollBar do
          if i > 0 then
            Position:= Position - Increment
          else
            Position := Position + Increment;
      end
      else if FControl.Focused then // DBGrid, StringGrid, Memo, ...
      begin
        if i > 0 then
          Msg.wParam := VK_UP
        else
          Msg.wParam := VK_DOWN;
      end;
    end;
  end;
  Handled := False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnMessage:= MouseWheel;
end;

Un saludo.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 13-10-2011 a las 09:21:22. Razón: Agregar comentarios
Responder Con Cita