Hydra 6 Delphi 7 IDE : Cannot focus a disabled or invisible window

Hydra Latest version.

In Delphi 7 IDE opening a form which inherits from THYVisualPlugin causes the exception
“Cannot focus a disabled or invisible window” to be displayed.

In Windows7 this message can be acknowledged, closed and you can continue to work.
In Windows10 this message can be acknowledged, but is redisplayed immediately meaning you cannot proceed in Delphi, the IDE needs to be forced closed.

Attached it the stack trace. The exception is caused by the following.

Hydra_Core_D7.bpl | uHYVisualPlugin | THYVisualPlugin | SetFocusedControl | 439[6] |

Could you just catch and discard this exception please.

hydra_exception.txt (85.4 KB)

Hi,

pls update uHYVisualPlugin.pas as

function THYVisualPlugin.SetFocusedControl(Control: TWinControl): Boolean;
begin
  Result := True;
  if ActiveControl <> Control then begin
    Result := inherited SetFocusedControl(Control);
    if not (csDesigning in ComponentState) then begin // added
      if ActiveControl <> nil then
        SendMessage(ParentWindow, WM_FOCUSOUTOFHOST, 0, 0);
      Control.SetFocus;
    end; //added
  end;
end;

and recompile Hydra_Core_D7.dpk

Thanks, logged as bugs://83819

bugs://83819 got closed with status fixed.

This fix will be in next public build

Hi Evgeny,

I am observing the same issue in Delphi 2010 unless I wrap the call to Control.SetFocus in a try…except block.

Regards

-Mohamed

Hi,

Have you caught this issue in design-time (i.e. in IDE) or in run-time?