Главная страница | назад





Article #20243: Conflict between InteliMouse driver v2.2d and TDBLookupComboBox

QUESTION:

Why is my application freezing when I pass the IntelliMouse pointer over a DBLookupComboBox?

ANSWER:

There is a conflict between the IntelliMouse driver v2.2d and TDBLookupComboBox. The error is reproduced by running an application which has a TDBLookupComboBox on a machine with IntelliMouse v2.2d. Click on the arrow in the box to show the dropdown list. Now move the mouse wheel, and the application freezes. The application must be killed to recover.

This issue does not occur with a TComboBox because TDBLookupComboBox is not a TComboBox descendent.

WORKAROUND

This issue was fixed in Delphi 5. Here is a workaround for Delphi 4 which requires adding two lines to DBCTRLS.PAS. The .DCU file will need to be rebuilt after adding these lines:

// This line takes care of the AV. ListLink.DataSet could be
// nil after the WM_MOUSEWHEEL wasn't handled and the Intellimouse
// driver decided to send a WM_VSCROLL

procedure TDBLookupListBox.WMVScroll(var Message: TWMVScroll);
begin
  SearchText := '';
(**** ADD THIS LINE ****)
  if ListLink.DataSet = nil then Exit;

  with Message, ListLink.DataSet do
end;

// This takes care of the "hang". The control is getting a 
// WM_KILLFOCUS immediately after the *second* WM_MOUSEWHEEL.
// Focus is retained by the drop-down list, making it appear
// that the application had stopped responding }

procedure TDBLookupComboBox.CloseUp(Accept: Boolean);
var
  Msg: TMsg;
  ListValue: Variant;
begin
  if FListVisible then
  begin
    if GetCapture <> 0 then SendMessage(GetCapture, WM_CANCELMODE, 0, 0);
(**** ADD THIS LINE ****)
    SetFocus;

    ListValue := FDataList.KeyValue;
...
end;

Last Modified: 28-DEC-00