[Lazarus] Windows.PostMessage vs Application.QueueAsyncCall

Marcos Douglas md at delfire.net
Tue Mar 18 14:47:24 CET 2014


On Mon, Mar 17, 2014 at 5:55 PM, Joao Morais <l at 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 at 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, yes, but I want to keep simple as possible.
>
>
> Simplicity and portability - two arguments on behalf of interfaces! =)

Simplicity with interfaces, not always...

Why portability?

>>> If I understood your
>>> scenario correctly: Main implements an interface known by Proc, which
>>> sends
>>> itself to the Proc constructor.
>>
>> That's an idea... but isn't like that today. Proc (following example)
>> do not know Main or any interface that Main knows.
>> Proc could be used in many others classes and not knows nothing about
>> these classes.
>
>
> Because of that Proc only knows an interface that Main, perhaps others
> should implement.
>
> Anyway just thinking out loud, you are the one that knows the requisites,
> what can and what can't be done. =)

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.

Regards,
Marcos Douglas




More information about the Lazarus mailing list