[Lazarus] Use rare Win32 API in LCLIntf.SetForegroundWindow

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Use rare Win32 API in LCLIntf.SetForegroundWindow

Free Pascal - Lazarus mailing list
What do you think about using this rare API [beginning from WinXP] in
LCLIntf fnction? It will make LCL function work more stable: window will
always go to foreground. I used it in CudaText. It works.

https://github.com/Alexey-T/CudaText/blob/master/app/fix_focus_window.pas

--
Regards,
Alexey

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Use rare Win32 API in LCLIntf.SetForegroundWindow

Free Pascal - Lazarus mailing list
On 23.05.2017 19:38, Alexey via Lazarus wrote:
> What do you think about using this rare API [beginning from WinXP] in
> LCLIntf fnction? It will make LCL function work more stable: window
> will always go to foreground. I used it in CudaText. It works.
>
> https://github.com/Alexey-T/CudaText/blob/master/app/fix_focus_window.pas

What are the equivalents for Qt, Qt5, Gtk2, Carbon, Cocoa?

Ondrej
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Use rare Win32 API in LCLIntf.SetForegroundWindow

Free Pascal - Lazarus mailing list
On 2017-05-23 18:43, Ondrej Pokorny via Lazarus wrote:
> What are the equivalents for Qt, Qt5, Gtk2, Carbon, Cocoa?

For anything running under X11 I have never had a problem with

   XRaiseWindow(xapplication.display, FWinHandle);

So Qt and GTK could you that, if they aren't already.


Regards,
   Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Use rare Win32 API in LCLIntf.SetForegroundWindow

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 23.05.2017 20:43, Ondrej Pokorny via Lazarus wrote:
> What are the equivalents for Qt, Qt5, Gtk2, Carbon, Cocoa?

I meaned - to use in _inside_ LCLIntf.SetForegrondWindow, not making new
LCL func.

--
Regards,
Alexey

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Use rare Win32 API in LCLIntf.SetForegroundWindow

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list

I would advise strongly against the use of SwitchToThisWindow API function in Lazarus. Mainly because it states in the docs: This function is not intended for general use. It may be altered or unavailable in subsequent versions of Windows.

Read more in Raymond Chen's blog - The life story of the SwitchToThisWindow function:
https://blogs.msdn.microsoft.com/oldnewthing/20111107-00/?p=9183

Denis


On 23/05/2017 18:38, Alexey via Lazarus wrote:
What do you think about using this rare API [beginning from WinXP] in LCLIntf fnction? It will make LCL function work more stable: window will always go to foreground. I used it in CudaText. It works.

https://github.com/Alexey-T/CudaText/blob/master/app/fix_focus_window.pas



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus