Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-17 Thread Gabor Boros

2015.10.17. 14:34 keltezéssel, Zeljko írta:

I found a problem. See the attached example. With Form2 works like a
charm after patch applied, but with Form1 works like before patch.


I don't understand. Can you explain better what's exact problem ?

zeljko


Start the example project, go to Form2 press down arrow in the editbox. 
You see green form displayed above Form2 and editbox have the focus. 
Works as expected. Try same steps on Form1, green form displayed above 
Form1, but editbox not got the focus and if click into the editbox green 
form go under Form1. I see this problem with KDE4.


Gabor

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-17 Thread Zeljko



On 10/16/2015 07:46 PM, Gabor Boros wrote:

Ok, then please open issue about it and attach example as you attached
in your e-mail, so then I'll commit patch and connect it to that issue
(so it's easier to track possible regressions).


I found a problem. See the attached example. With Form2 works like a
charm after patch applied, but with Form1 works like before patch.


I don't understand. Can you explain better what's exact problem ?

zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Gabor Boros

Ok, then please open issue about it and attach example as you attached
in your e-mail, so then I'll commit patch and connect it to that issue
(so it's easier to track possible regressions).


I found a problem. See the attached example. With Form2 works like a 
charm after patch applied, but with Form1 works like before patch.


Gabor


Show_SetFocus2.tar.gz
Description: application/gzip
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Gabor Boros

2015.10.16. 15:07 keltezéssel, Zeljko írta:


Ok, then please open issue about it and attach example as you attached
in your e-mail, so then I'll commit patch and connect it to that issue
(so it's easier to track possible regressions).


http://bugs.freepascal.org/view.php?id=28863

Patch tested with fixes_1_4 too and works.

Thank you!

Gabor

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Zeljko



On 10/16/2015 02:44 PM, Gabor Boros wrote:

2015.10.16. 14:15 keltezéssel, Zeljko írta:

Is fsStayOnTop working properly? Because I see fsSystemStayOnTop exists
too.


Under X11 they're same. Pls, try another patch which uses another
approach (I've sent it in previous mail).


I nor see difference on Windows between fsStayOnTop and fsSystemStayOnTop.

Tried second patch with trunk and awesome. Works like a charm!
The SetFocus problem is fixed also.


Ok, then please open issue about it and attach example as you attached 
in your e-mail, so then I'll commit patch and connect it to that issue 
(so it's easier to track possible regressions).


zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Gabor Boros

2015.10.16. 14:15 keltezéssel, Zeljko írta:

Is fsStayOnTop working properly? Because I see fsSystemStayOnTop exists
too.


Under X11 they're same. Pls, try another patch which uses another
approach (I've sent it in previous mail).


I nor see difference on Windows between fsStayOnTop and fsSystemStayOnTop.

Tried second patch with trunk and awesome. Works like a charm!
The SetFocus problem is fixed also.

Gabor

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Zeljko



On 10/16/2015 02:02 PM, Gabor Boros wrote:

2015.10.16. 13:41 keltezéssel, Zeljko írta:


Please try with attached patch. In this case you can test without
FormStyle := fsStayOnTop. FYI, in this patch I'm setting stayontop for
X11 so that could make a problem.
Test with this patch and let me know if this is what you want. If not I
have (maybe) another solution.

zeljko


I see same as with FormStyle := fsStayOnTop.
Green form stay above every opened windows in the OS.

Is fsStayOnTop working properly? Because I see fsSystemStayOnTop exists
too.


Under X11 they're same. Pls, try another patch which uses another 
approach (I've sent it in previous mail).


zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Gabor Boros

2015.10.16. 13:41 keltezéssel, Zeljko írta:


Please try with attached patch. In this case you can test without
FormStyle := fsStayOnTop. FYI, in this patch I'm setting stayontop for
X11 so that could make a problem.
Test with this patch and let me know if this is what you want. If not I
have (maybe) another solution.

zeljko


I see same as with FormStyle := fsStayOnTop.
Green form stay above every opened windows in the OS.

Is fsStayOnTop working properly? Because I see fsSystemStayOnTop exists too.

Gabor

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Zeljko
Another patch is attached (it uses cheat via QtTool flag instead 
QtWindowStaysOnTop) ... let me know if this one is what you want.


zeljko

Index: lcl/interfaces/qt/qtwsforms.pp
===
--- lcl/interfaces/qt/qtwsforms.pp	(revision 50082)
+++ lcl/interfaces/qt/qtwsforms.pp	(working copy)
@@ -556,19 +556,32 @@
   if AWinControl.HandleObjectShouldBeVisible and
 not (TCustomForm(AWinControl).FormStyle in fsAllStayOnTop) and
 not (fsModal in TCustomForm(AWinControl).FormState) and
+(TCustomForm(AWinControl).FormStyle <> fsMDIChild) and
 (TCustomForm(AWinControl).PopupMode = pmAuto) and
 (TCustomForm(AWinControl).BorderStyle = bsNone) and
 (TCustomForm(AWinControl).PopupParent = nil) then
   begin
 W := QApplication_activeWindow;
-if (W <> nil) and not QWidget_isModal(W) then
+if (W <> nil) then
 begin
-  Flags := QWidget_windowFlags(W);
-  if (Flags and QtWindowStaysOnTopHint <> QtWindowStaysOnTopHint) and
-GetAlwaysOnTopX11(W) then
+  if not QWidget_isModal(W) then
   begin
-Flags := Widget.windowFlags;
-Widget.setWindowFlags(Flags or QtWindowStaysOnTopHint);
+Flags := QWidget_windowFlags(W);
+if (Flags and QtWindowStaysOnTopHint <> QtWindowStaysOnTopHint) and
+  GetAlwaysOnTopX11(W) then
+begin
+  Flags := Widget.windowFlags;
+  Widget.setWindowFlags(Flags or QtWindowStaysOnTopHint);
+end;
+  end else
+  begin
+Flags := QWidget_windowFlags(W);
+if (Flags and QtWindowStaysOnTopHint <> QtWindowStaysOnTopHint) and
+  not GetAlwaysOnTopX11(W) then
+begin
+  Flags := Widget.windowFlags;
+  Widget.setWindowFlags(Flags or QtTool);
+end;
   end;
 end;
   end;
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Zeljko



On 10/16/2015 01:33 PM, Gabor Boros wrote:

2015.10.16. 13:14 keltezéssel, Zeljko írta:


You can set FormStyle := fsStayOnTop for that popup form so you'll
achieve that effect.

zeljko


I tried this before wrote to the list but have a side effect. The green
form showed above all other opened windows (not just form's of current
application) in the OS with KDE4 and Windows too.


Please try with attached patch. In this case you can test without 
FormStyle := fsStayOnTop. FYI, in this patch I'm setting stayontop for 
X11 so that could make a problem.
Test with this patch and let me know if this is what you want. If not I 
have (maybe) another solution.


zeljko
Index: lcl/interfaces/qt/qtwsforms.pp
===
--- lcl/interfaces/qt/qtwsforms.pp	(revision 50082)
+++ lcl/interfaces/qt/qtwsforms.pp	(working copy)
@@ -556,19 +556,32 @@
   if AWinControl.HandleObjectShouldBeVisible and
 not (TCustomForm(AWinControl).FormStyle in fsAllStayOnTop) and
 not (fsModal in TCustomForm(AWinControl).FormState) and
+(TCustomForm(AWinControl).FormStyle <> fsMDIChild) and
 (TCustomForm(AWinControl).PopupMode = pmAuto) and
 (TCustomForm(AWinControl).BorderStyle = bsNone) and
 (TCustomForm(AWinControl).PopupParent = nil) then
   begin
 W := QApplication_activeWindow;
-if (W <> nil) and not QWidget_isModal(W) then
+if (W <> nil) then
 begin
-  Flags := QWidget_windowFlags(W);
-  if (Flags and QtWindowStaysOnTopHint <> QtWindowStaysOnTopHint) and
-GetAlwaysOnTopX11(W) then
+  if not QWidget_isModal(W) then
   begin
-Flags := Widget.windowFlags;
-Widget.setWindowFlags(Flags or QtWindowStaysOnTopHint);
+Flags := QWidget_windowFlags(W);
+if (Flags and QtWindowStaysOnTopHint <> QtWindowStaysOnTopHint) and
+  GetAlwaysOnTopX11(W) then
+begin
+  Flags := Widget.windowFlags;
+  Widget.setWindowFlags(Flags or QtWindowStaysOnTopHint);
+end;
+  end else
+  begin
+Flags := QWidget_windowFlags(W);
+if (Flags and QtWindowStaysOnTopHint <> QtWindowStaysOnTopHint) and
+  not GetAlwaysOnTopX11(W) then
+begin
+  Flags := Widget.windowFlags;
+  Widget.setWindowFlags(Flags or QtWindowStaysOnTopHint);
+end;
   end;
 end;
   end;
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Gabor Boros

2015.10.16. 13:14 keltezéssel, Zeljko írta:


You can set FormStyle := fsStayOnTop for that popup form so you'll
achieve that effect.

zeljko


I tried this before wrote to the list but have a side effect. The green 
form showed above all other opened windows (not just form's of current 
application) in the OS with KDE4 and Windows too.


Gabor

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Zeljko



On 10/16/2015 12:25 PM, Gabor Boros wrote:

Hi All,

The attached example works on Windows properly. But not with Linux Qt
(KDE4). I want to see the green form above Form2 while Form2.Edit1
focused. (Press btnForm2 on Form1 and press Button1 on Form2.) If focus
Edit1 manually the green form go under Form2. I reported some problem
earlier as bug in the tracker but revealed just lack of my knowledge.
Now try this place first...


You can set FormStyle := fsStayOnTop for that popup form so you'll 
achieve that effect.


zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Zeljko



On 10/16/2015 12:25 PM, Gabor Boros wrote:

Hi All,

The attached example works on Windows properly. But not with Linux Qt
(KDE4). I want to see the green form above Form2 while Form2.Edit1
focused. (Press btnForm2 on Form1 and press Button1 on Form2.) If focus
Edit1 manually the green form go under Form2. I reported some problem
earlier as bug in the tracker but revealed just lack of my knowledge.
Now try this place first...


hmmm...yes, using KDE4 green popup form is below modal form when I click 
into TEdit control. Better create issue and attach Show_SetFocus.tar.gz 
as example so it won't be forgotten.


zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] SetFocus have no effect after TCustomForm.Show

2015-10-16 Thread Gabor Boros

Hi All,

The attached example works on Windows properly. But not with Linux Qt 
(KDE4). I want to see the green form above Form2 while Form2.Edit1 
focused. (Press btnForm2 on Form1 and press Button1 on Form2.) If focus 
Edit1 manually the green form go under Form2. I reported some problem 
earlier as bug in the tracker but revealed just lack of my knowledge. 
Now try this place first...


Gabor


Show_SetFocus.tar.gz
Description: application/gzip
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus