Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2105
  • Last Modified:

How to disable mouse wheel when TComboBox has focus

I have a form with a combobox and a twebbrowser - I want the mouse wheel to work only if the twebbrowser is active - how can this be done?

Thank you.
0
moonrise
Asked:
moonrise
  • 2
1 Solution
 
DaFoxCommented:
Hi moonrise!

Try this:

type
  TComboBox = class(StdCtrls.TComboBox)
  protected
    procedure ComboWndProc(var Message: TMessage; ComboWnd: hWnd; ComboProc: Pointer); override;
  end;

  TForm1 = class(TForm)
    ComboBox1: TComboBox;
  private

...

procedure TComboBox.ComboWndProc(var Message: TMessage; ComboWnd: HWnd; ComboProc: Pointer);
begin
  if (WebBrowserNotActive and ((Message.Msg = WM_VSCROLL) or (Message.Msg = WM_HSCROLL) or (Message.msg = WM_Mousewheel))) then Message.Msg := 0;
  inherited;
end;

Markus
0
 
moonriseAuthor Commented:
works great, thank you
0
 
DaFoxCommented:
You're welcome. Thanks for the points.

Markus
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now