[Lazarus] How to create a non focusable form?

Zeljko zeljko at holobit.net
Tue Oct 27 16:45:02 CET 2015



On 10/27/2015 04:16 PM, Zeljko wrote:
>
>
> On 10/27/2015 04:04 PM, Gabor Boros wrote:
>> Hi All,
>>
>> I want to create a borderless non modal form (native Windows and
>> Linux-Qt) which not catch the focus on mouse click. Tried with modified
>> ControlStyle and CanFocus override but without success. Any other idea?
>
> csNoFocus does not work for Qt ? Can you provide example ?
> For Qt: before example try to include qt4 and qtwidgets into your unit
> and then
> in CreateWnd of your custom form (or after form handle is created)
>
> TQtMainWindow(YourForm.Handle).SetFocusPolicy(QtNoFocus);
> TQtMainWindow(YourForm.Handle).WindowArea.SetFocusPolicy(QtNoFocus);

Of course , you can try with THintWindow as Ondrej mentioned, but if 
form is bsNone than it should not take focus. Don't know what happens 
with framed forms on linux....if you click on frame then X11 rules are 
unpredictible.
Also, you can set QWidget attribute QtWA_ShowWithoutActivating, but that 
should be setted up before form is shown (eg in FormCreate call 
HandleNeeded and set focusPolicy and attributes). See 
QtWSControls/qtint, there's dnd imagelist operation and we are using 
ShowWithoutActivating etc ...



zeljko




More information about the Lazarus mailing list