Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-19 Thread Michael Schnell
On 03/19/2014 12:53 AM, Hans-Peter Diettrich wrote: This queue may be unusable for LCL messages (dunno). It _is_ used for the said purpose, simply because the TThread class is provided by the fpc RTL (not the LCL) and here it can't do other but feed the Queue in the RTL. And this obviously

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-19 Thread Michael Schnell
On 03/18/2014 05:52 PM, Joao Morais wrote: I missed the async part, sorry. What about reuse App.QueueAsyncCall with interface? Combining the Interface idea with asynchronous signaling in fact is a nice idea. The real issue is that in many cases you need to queue not only the call but the

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-19 Thread Martin Schreiber
On Wednesday 19 March 2014 11:31:25 Michael Schnell wrote: The real issue is that in many cases you need to queue not only the call but the parameters for the call as well. Maybe have a look how it is done in MSEgui with tmseevent/tobjectevent, application.postevent() and friends? IIRC you

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-19 Thread Michael Schnell
On 03/19/2014 02:04 AM, Hans-Peter Diettrich wrote: For Windows applications you should eventually know some bits about the main thread message queue. Not really, as LCL and RTL provide as well TThread.Queue and Application.QueueAsyncCall in Windows and Linux (and Mac, AFAIK). In Delphi you

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-19 Thread Michael Schnell
On 03/19/2014 01:00 PM, Martin Schreiber wrote: Maybe have a look how it is done in MSEgui with tmseevent/tobjectevent, application.postevent() and friends? IIRC you already played with them? :-) :-) :-) Yep ! I do like this stuff ! On behalf of OS and Widget-Set independent and user

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Michael Schnell
On 03/17/2014 11:22 AM, Hans-Peter Diettrich wrote: Michael Schnell schrieb: This is a Windowish left-over and really alien regarding the OS-independent making of the LCL (even though In fact the LCL even simulates PostMessage in Linux. How would you handle keyboard and mouse input and

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Michael Schnell
On 03/17/2014 10:38 PM, Sven Barth wrote: Am 17.03.2014 19:15 schrieb Hans-Peter Diettrich drdiettri...@aol.com mailto:drdiettri...@aol.com: How would you handle keyboard and mouse input and painting in an application? Like any other widgetset which does know nothing about PostMessage

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Hans-Peter Diettrich
Michael Schnell schrieb: On 03/17/2014 11:22 AM, Hans-Peter Diettrich wrote: Michael Schnell schrieb: This is a Windowish left-over and really alien regarding the OS-independent making of the LCL (even though In fact the LCL even simulates PostMessage in Linux. How would you handle

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Michael Schnell
On 03/18/2014 09:57 AM, Hans-Peter Diettrich wrote: The LCL is based on the message queue, regardless of any OS or widgetset. PostMessage is part of the message queue. Yep. (Even though I prefer the term Event Queue as the queued information this is not necessarily similar to Windowish

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Hans-Peter Diettrich
Michael Schnell schrieb: On 03/18/2014 09:57 AM, Hans-Peter Diettrich wrote: The LCL is based on the message queue, regardless of any OS or widgetset. PostMessage is part of the message queue. Yep. (Even though I prefer the term Event Queue as the queued information this is not necessarily

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Marcos Douglas
On Mon, Mar 17, 2014 at 5:55 PM, Joao Morais l...@joaomorais.com.br wrote: Em 17/03/14 16:28, Marcos Douglas escreveu: On Mon, Mar 17, 2014 at 3:12 PM, Joao Morais l...@joaomorais.com.br wrote: Em 15/03/14 22:47, Marcos Douglas escreveu: So, what the best way to substitute PostMessage?

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Michael Schnell
On 03/18/2014 02:13 PM, Hans-Peter Diettrich wrote: Then try to explain how e.g. a key or button press event is processed in your model. I don't have a model. I just tried to describe what the LCL does. You can see the multiple Queues in the source code: - Queue in the fpc RTL that is fed

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Joao Morais
Em 18/03/14 10:47, Marcos Douglas escreveu: a form needs to notify many windows using asynchronous messages. PostMessage do that but some programmers say this is an old Windowish approach so, I'm searching another method to do the same PostMessage does and making the code more cross. I missed

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Hans-Peter Diettrich
Michael Schnell schrieb: On 03/18/2014 02:13 PM, Hans-Peter Diettrich wrote: Then try to explain how e.g. a key or button press event is processed in your model. I don't have a model. I just tried to describe what the LCL does. You can see the multiple Queues in the source code: -

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Marcos Douglas
On Tue, Mar 18, 2014 at 1:52 PM, Joao Morais l...@joaomorais.com.br wrote: Em 18/03/14 10:47, Marcos Douglas escreveu: a form needs to notify many windows using asynchronous messages. PostMessage do that but some programmers say this is an old Windowish approach so, I'm searching another

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Marcos Douglas
On Tue, Mar 18, 2014 at 10:04 PM, Hans-Peter Diettrich drdiettri...@aol.com wrote: Marcos Douglas schrieb: The requisites isn't a secret: a form needs to notify many windows using asynchronous messages. PostMessage do that but some programmers say this is an old Windowish approach so, I'm

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-18 Thread Hans-Peter Diettrich
Marcos Douglas schrieb: The requisites isn't a secret: a form needs to notify many windows using asynchronous messages. PostMessage do that but some programmers say this is an old Windowish approach so, I'm searching another method to do the same PostMessage does and making the code more cross.

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/16/2014 02:47 AM, Marcos Douglas wrote: Like all Windows programmer, I use PostMessage/SendMessage a lot. Lazarus team has created Application.QueueAsyncCall method to substitute the (old) Windowish method todo async calls aka PostMessage. Ok. But what is the best way to use

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/16/2014 09:23 AM, zeljko wrote: Why you must substitute PostMessage ? This is a Windowish left-over and really alien regarding the OS-independent making of the LCL (even though In fact the LCL even simulates PostMessage in Linux. -Michael --

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread zeljko
On 03/17/2014 10:56 AM, Michael Schnell wrote: On 03/16/2014 02:47 AM, Marcos Douglas wrote: Like all Windows programmer, I use PostMessage/SendMessage a lot. Lazarus team has created Application.QueueAsyncCall method to substitute the (old) Windowish method todo async calls aka PostMessage.

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/17/2014 11:03 AM, zeljko wrote: No, I'll keep using QueueAsyncCall as it is because it satisfies my needs. I am with you, as QueueAsyncCall additionally provides queuing a parameter for the procedure to be called in the main thread. -Michael --

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Marcos Douglas
On Mon, Mar 17, 2014 at 6:56 AM, Michael Schnell mschn...@lumino.de wrote: On 03/16/2014 02:47 AM, Marcos Douglas wrote: Like all Windows programmer, I use PostMessage/SendMessage a lot. Lazarus team has created Application.QueueAsyncCall method to substitute the (old) Windowish method todo

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/17/2014 01:31 PM, Marcos Douglas wrote: Yes, but the QueueAsyncCall needs to know what procedure to call for a especific object (instance) I don't understand. The definition of the function (I use) is procedure TApplication.QueueAsyncCall(const AMethod: TDataEvent; Data: PtrInt);

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Marcos Douglas
On Mon, Mar 17, 2014 at 11:11 AM, Michael Schnell mschn...@lumino.de wrote: On 03/17/2014 01:31 PM, Marcos Douglas wrote: Yes, but the QueueAsyncCall needs to know what procedure to call for a especific object (instance) I don't understand. The definition of the function (I use) is

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/17/2014 03:36 PM, Marcos Douglas wrote: The pointer to the Event Procedure, the self pointer of it's instance (both denoted by AMethod) and the pointer to the parameter to have it called with (denoted byData are queued and when the main thread is ready to handle the event, it calls

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/17/2014 04:09 PM, Michael Schnell wrote: If you meant the self pointer of AMethod, I of course am with you (as same is a procedure of object). But that is rather trivial, and AMethod could be a procedure of any class (inducing but not forcing the TThread instance that schedules the

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/17/2014 04:20 PM, Michael Schnell wrote: I'm not sure if you simply can do free; as the last instruction before returning from the procedure. I just did a test and even this seems to work: An object seemingly can free itself and return to the caller of the function just as if this

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Marcos Douglas
On Mon, Mar 17, 2014 at 12:20 PM, Michael Schnell mschn...@lumino.de wrote: On 03/17/2014 04:09 PM, Michael Schnell wrote: If you meant the self pointer of AMethod, I of course am with you (as same is a procedure of object). But that is rather trivial, and AMethod could be a procedure of

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Marcos Douglas
On Mon, Mar 17, 2014 at 1:35 PM, Michael Schnell mschn...@lumino.de wrote: On 03/17/2014 04:20 PM, Michael Schnell wrote: I'm not sure if you simply can do free; as the last instruction before returning from the procedure. I just did a test and even this seems to work: An object seemingly

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Michael Schnell
On 03/17/2014 05:42 PM, Marcos Douglas wrote: Could you send the sources of this test? I could if you are interested. This is a testing project I did for the development of Widget Types (with and without GUI Binding) on behalf of TThread.Synchronize, TThread.Queue,

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Marcos Douglas
On Mon, Mar 17, 2014 at 2:25 PM, Michael Schnell mschn...@lumino.de wrote: On 03/17/2014 05:42 PM, Marcos Douglas wrote: Could you send the sources of this test? I could if you are interested. This is a testing project I did for the development of Widget Types (with and without GUI

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Joao Morais
Em 15/03/14 22:47, Marcos Douglas escreveu: So, what the best way to substitute PostMessage? Maybe using QueueAsyncCall + IFPObserved/IFPObserver? Have you tried decoupling your classes with interfaces? If I understood your scenario correctly: Main implements an interface known by Proc,

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Hans-Peter Diettrich
Michael Schnell schrieb: On 03/16/2014 09:23 AM, zeljko wrote: Why you must substitute PostMessage ? This is a Windowish left-over and really alien regarding the OS-independent making of the LCL (even though In fact the LCL even simulates PostMessage in Linux. How would you handle

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Marcos Douglas
On Mon, Mar 17, 2014 at 3:12 PM, Joao Morais l...@joaomorais.com.br wrote: Em 15/03/14 22:47, Marcos Douglas escreveu: So, what the best way to substitute PostMessage? Maybe using QueueAsyncCall + IFPObserved/IFPObserver? Have you tried decoupling your classes with interfaces? I thought,

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Joao Morais
Em 17/03/14 16:28, Marcos Douglas escreveu: On Mon, Mar 17, 2014 at 3:12 PM, Joao Morais l...@joaomorais.com.br wrote: Em 15/03/14 22:47, Marcos Douglas escreveu: So, what the best way to substitute PostMessage? Maybe using QueueAsyncCall + IFPObserved/IFPObserver? Have you tried

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-17 Thread Sven Barth
Am 17.03.2014 19:15 schrieb Hans-Peter Diettrich drdiettri...@aol.com: Michael Schnell schrieb: On 03/16/2014 09:23 AM, zeljko wrote: Why you must substitute PostMessage ? This is a Windowish left-over and really alien regarding the OS-independent making of the LCL (even though In fact

Re: [Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

2014-03-16 Thread zeljko
On 03/16/2014 02:47 AM, Marcos Douglas wrote: Hi, Like all Windows programmer, I use PostMessage/SendMessage a lot. Lazarus team has created Application.QueueAsyncCall method to substitute the (old) Windowish method todo async calls aka PostMessage. Ok. But what is the best way to use