[Lazarus] How to create a non focusable form?

Zeljko zeljko at holobit.net
Wed Oct 28 11:51:16 CET 2015



On 10/28/2015 11:43 AM, Gabor Boros wrote:
> 2015.10.28. 10:59 keltezéssel, Zeljko írta:
>>
>> Please test with attached patch and give feedback. Note that this patch
>> is tested under Qt X11 only.
>>
>> zeljko
>
> With the original example works but...
>
> Modified the example...
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
>    MyForm:TMyForm;
>
> begin
>    MyForm:=TMyForm.CreateNew(Nil);
>    with TButton.Create(MyForm) do Parent:=MyForm;
>    MyForm.Show;
> end;
>
> The button appear on the form only if modify ControlStyle in the example
> from
>
> ControlStyle:=ControlStyle+[csNoFocus,csNoStdEvents]-[csCaptureMouse,csClickEvents];
>
>
>   to
>
> ControlStyle:=ControlStyle+[csNoFocus]-[csCaptureMouse,csClickEvents];

I'll check that. csNoStdEvent is passed to form inside Qt widgetset

>
> (csNoStdEvents removed) but after form grab focus if click on it or
> click on the button.

Ok, then go to QtWSForms, TQtWSCustomForms.UpdateWindowFlags and comment 
if csNoStdEvents ..... leave only
Flags := Flags or QtX11BypassWindowManagerHint;

in this case form will not take focus in any case, but must see what 
happens with parenting (button is not visible because of this param I 
guess).

zeljko




More information about the Lazarus mailing list