Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-13 Thread Bo Berglund via lazarus
On Fri, 12 Feb 2021 21:43:02 +, Patrick Chevalley via lazarus wrote: >The declaration of QueueAsyncCall is: >procedure QueueAsyncCall(const AMethod: TDataEvent; Data: PtrInt); > >You must use "arg: PtrInt" otherwise it will fail on a 32bit system. > Thanks for the pointer! I changed it and i

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-12 Thread Patrick Chevalley via lazarus
The declaration of QueueAsyncCall is: procedure QueueAsyncCall(const AMethod: TDataEvent; Data: PtrInt); You must use "arg: PtrInt" otherwise it will fail on a 32bit system. Patrick 12 février 2021 22:34 "Bo Berglund via lazarus" a écrit: > On Fri, 12 Feb 2021 21:23:19 +0100, Jean SUZINEAU v

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-12 Thread Bo Berglund via lazarus
On Fri, 12 Feb 2021 21:23:19 +0100, Jean SUZINEAU via lazarus wrote: >Le 12/02/2021 à 17:39, Bo Berglund via lazarus a écrit : >>Application.QueueAsyncCall(@CopyScreenRect(0), 0); // <== ERROR here > >I'm not sure, but QueueAsyncCall just need the address of your callback: > >Application.Queu

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-12 Thread Jean SUZINEAU via lazarus
oops: when it will be called. -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-12 Thread Jean SUZINEAU via lazarus
Le 12/02/2021 à 17:39, Bo Berglund via lazarus a écrit : Application.QueueAsyncCall(@CopyScreenRect(0), 0); // <== ERROR here I'm not sure, but QueueAsyncCall just need the address of your callback: Application.QueueAsyncCall(@CopyScreenRect, 0); The 0 given to QueueAsyncCall will end up a

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-12 Thread Bo Berglund via lazarus
On Fri, 12 Feb 2021 12:51:08 +0100, Luca Olivetti via lazarus wrote: >El 12/2/21 a les 11:16, Bo Berglund via lazarus ha escrit: >ing a bogus extra argument as zero but that just changed to a >> different error message... >> >> Application.QueueAsyncCall(@CopyScreenRect, 0); >> >> formmain.pas(

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-12 Thread Luca Olivetti via lazarus
El 12/2/21 a les 11:16, Bo Berglund via lazarus ha escrit: ing a bogus extra argument as zero but that just changed to a different error message... Application.QueueAsyncCall(@CopyScreenRect, 0); formmain.pas(149,45) Error: Incompatible type for arg no. 1: Got "", expected "" It's telling you

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-12 Thread Bo Berglund via lazarus
On Fri, 12 Feb 2021 00:25:17 -0300, Flávio Etrusco via lazarus wrote: >Menu handling in Windows is fully synchronous (in the main thread) so >you should use QueueAsyncCall: >https://wiki.freepascal.org/Asynchronous_Calls > >Best regards, >Flávio I tried modifying my menuclick event as follows:

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-11 Thread Flávio Etrusco via lazarus
Menu handling in Windows is fully synchronous (in the main thread) so you should use QueueAsyncCall: https://wiki.freepascal.org/Asynchronous_Calls Best regards, Flávio Em dom., 7 de fev. de 2021 às 11:20, Bo Berglund via lazarus escreveu: > > On Sun, 7 Feb 2021 17:16:31 +0300, Andrey Sobol via

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-07 Thread Bo Berglund via lazarus
On Sun, 7 Feb 2021 17:16:31 +0300, Andrey Sobol via lazarus wrote: >Try to call > >Application.ProcessMessages(); >after disable a popup menu. > >Andrey. > Did not work. popmenu item still shows on captured image. The Sleep(300) in the menu handler does work OTOH... -- Bo Berglund Developer i

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-07 Thread Andrey Sobol via lazarus
Try to call Application.ProcessMessages(); after disable a popup menu. Andrey. On 07.02.2021 17:09, Bo Berglund via lazarus wrote: On Sun, 7 Feb 2021 14:01:46 +, Denis Kozlov via lazarus wrote: I had a similar experience with taking a screenshot programmatically. Simply waiting or proc

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-07 Thread Bo Berglund via lazarus
On Sun, 7 Feb 2021 14:01:46 +, Denis Kozlov via lazarus wrote: > >I had a similar experience with taking a screenshot programmatically. >Simply waiting or processing application messages after hiding the form >often doesn't help, and results in a form being a part of the screenshot >anyway

Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-07 Thread Denis Kozlov via lazarus
Hi, I had a similar experience with taking a screenshot programmatically. Simply waiting or processing application messages after hiding the form often doesn't help, and results in a form being a part of the screenshot anyway. I managed to work around it by forcing Windows to repaint everyth

[Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-07 Thread Bo Berglund via lazarus
I have worked on a tool to copy a region of the Windows desktop for use in illustrations. The tool consists of a transparent form which is supposed to be located on top of the area to copy. This form has a pop-up menu where there are 3 items to select from: - Copy image - Copy position - Close Wh