Question: We are using modified `TToolWindow97 = class(TCustomControl)` component.

![enter image description here](https://i.stack.imgur.com/dPlZd.png)

I can only find it on `TForm.Components`. And there is no it on `TForm.Controls`. So, `TForm.ActiveControl` is nil and `TToolWindow97.Focused = False` when `TToolWindow97` is focused. I need to know when it's focused.

I also tried to find any focused control on `TToolWindow97`. But all of them return `Focused = False`.

How to find out if `TToolWindow97` (inheried from `TCustomControl`) is focused when `Focused` property returns always `False`?

P.S. The `TToolWindow97` window has a shadow on the image. Only focused `TToolWindow97` windows have it - so focus exists. And I may focus any control on it. But all of them return `Focused = False`. I don't know why.

Thanks a lot for the help!

Answer: 
The toolbar button does not have the focus. In the image, it's clear that the grid control has the focus — it has a dotted focus rectangle, and the cell is highlighted with the focus color.

The "15" button with the shadowed image is being *pointed at* with the mouse. It's in its "hover" or "hot" state, not its "focus" state. In the code, the name of the state is `bsMouseIn`, and it's stored in the `FState` field; that field has protected visibility and is not exposed through any public property or method. You might be interested in the `OnMouseEnter` and `OnMouseExit` events.

Toolbar buttons rarely acquire the focus. They're meant to be operated solely with the mouse. To operate them with the keyboard, you're meant to press their associated shortcut key combinations instead. The particular button control, `TToolbarButton97`, definitely never acquires the focus because it descends from `TGraphicControl`.
1). Scan the following Handles when TBToolWindow is focused and not:

```
        aHandle := (Sender as TForm).Handle;
        aHandle := aVisible.Handle;
        aHandle := GetForegroundWindow;
        aHandle := GetActiveWindow;
        aHandle := Screen.ActiveForm.Handle;
        aHandle := Application.ActiveFormHandle;

```

So, the difference is only on Screen.ActiveForm.Handle.

2). Install the Microsoft Spy.

3). Convert Screen.ActiveForm.Handle to HEX and find them on the Spy.

4). Look to classes. So, when TTBToolWindow is focused, class of aHandle is TBFloatingWindowParent.

5). Write code to seek the correct active floating window (TTBToolWindow) by TBFloatingWindowParent control.