Re: [Lazarus] LCL Message handling

2011-10-20 Thread Paul Ishenin

20.10.2011 0:27, Hans-Peter Diettrich wrote:

Since no message IDs exist for other platforms, I'd assume that the LM
messages are equivalent to the WM IDs. But why new names for old names?


Can you give some examples of new names? Or you just complain about LM_ 
and WM_ prefixes?


Prefixes are different to show that message can be not the same as 
windows passed it. So it just warns developer that it not exact windows 
message.


Best regards,
Paul Ishenin


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


Re: [Lazarus] LCL Message handling

2011-10-20 Thread Hans-Peter Diettrich

Paul Ishenin schrieb:

20.10.2011 0:27, Hans-Peter Diettrich wrote:

Since no message IDs exist for other platforms, I'd assume that the LM
messages are equivalent to the WM IDs. But why new names for old names?


Can you give some examples of new names? Or you just complain about LM_ 
and WM_ prefixes?


I e.g. wonder about method names like WMNotify, associated with an 
LM_NOTIFY message ID.



Prefixes are different to show that message can be not the same as 
windows passed it. So it just warns developer that it not exact windows 
message.


This would be an acceptable explanation.

DoDi


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


[Lazarus] LCL Message handling

2011-10-19 Thread Hans-Peter Diettrich
Can somebody explain the purpose of e.g. WindowProc, WndProc and 
MainWndProc, in the LCL?


What's the purpose of TWinControl.MainWndProc, when it's never called or 
used otherwise, does nothing, and is not virtual?


In Delphi MainWndProc calls the handler assigned to WindowProc, enclosed 
in try-finally and try-except blocks. WindowProc typically is 
initialized with WndProc. Why is this implemented differently in the 
LCL, and how?


DoDi


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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Felipe Monteiro de Carvalho
On Wed, Oct 19, 2011 at 1:56 PM, Hans-Peter Diettrich
drdiettri...@aol.com wrote:
 Can somebody explain the purpose of e.g. WindowProc, WndProc and
 MainWndProc, in the LCL?

Delphi compatibility. AFAIK WndProc works for messages = WM_USER

 In Delphi MainWndProc calls the handler assigned to WindowProc, enclosed in
 try-finally and try-except blocks. WindowProc typically is initialized with
 WndProc. Why is this implemented differently in the LCL, and how?

I remember that some people did not like how this worked in Delphi so
it didn't work like that, then we had a define to pass messages =
WM_USER to WndProc. I think the define later got changed into always
active. I don't remember anyone asking for messages  WM_USER, so
probably till now they are not passed to WndProc. I'm just typing from
memory, so I could be wrong in parts of this.

-- 
Felipe Monteiro de Carvalho

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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Hans-Peter Diettrich

Felipe Monteiro de Carvalho schrieb:

On Wed, Oct 19, 2011 at 1:56 PM, Hans-Peter Diettrich
drdiettri...@aol.com wrote:

Can somebody explain the purpose of e.g. WindowProc, WndProc and
MainWndProc, in the LCL?


Delphi compatibility. AFAIK WndProc works for messages = WM_USER


WndProc can preprocess *any* kind of messages, which must be handled in 
a non-standard way in a specific control, e.g. the TripleClick messages. 
WndProc finally calls Dispatch, to invoke the implemented message 
handler of the control, or DefaultHandler for all messages without 
assigned handlers.



In Delphi MainWndProc calls the handler assigned to WindowProc, enclosed in
try-finally and try-except blocks. WindowProc typically is initialized with
WndProc. Why is this implemented differently in the LCL, and how?


I remember that some people did not like how this worked in Delphi so
it didn't work like that, then we had a define to pass messages =
WM_USER to WndProc. I think the define later got changed into always
active. I don't remember anyone asking for messages  WM_USER, so
probably till now they are not passed to WndProc. I'm just typing from
memory, so I could be wrong in parts of this.


I fear that Delphi compatibility is broken, when MainWndProc does 
nothing. When it is not removed, it should do what Delphi does, so that 
it can be used in code ported from Delphi. Otherwise it should be 
removed, together with WindowProc, so that every attempt to use it will 
result in compiler errors.



I also don't understand the parallel or different WM..., LM..., CM... 
and CN... message IDs. Is that separation related to messages handled 
(or not handled) by widgets or by the LCL? Or have the LM... message IDs 
been added only to prevent cyclic unit references?


DoDi


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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Felipe Monteiro de Carvalho
On Wed, Oct 19, 2011 at 2:52 PM, Hans-Peter Diettrich
drdiettri...@aol.com wrote:
 WndProc can preprocess *any* kind of messages, which must be handled in a
 non-standard way in a specific control, e.g. the TripleClick messages.
 WndProc finally calls Dispatch, to invoke the implemented message handler of
 the control, or DefaultHandler for all messages without assigned handlers.

You can wait some days to see if anyone is against the change and if
not (Vincent didn't like this as far as I remember, so it would be
good to hear from him). If there is no answer in 1 week then you can
send a patch to bug tracker where this can then be further discussed.

 I also don't understand the parallel or different WM..., LM..., CM... and
 CN... message IDs. Is that separation related to messages handled (or not
 handled) by widgets or by the LCL? Or have the LM... message IDs been added
 only to prevent cyclic unit references?

LM messages are sent from the LCL-Widgetsets to the LCL, so they are
cross-platform. WM messages are only for Windows. I don't know what
CM/CN messages are.

-- 
Felipe Monteiro de Carvalho

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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Vincent Snijders
2011/10/19 Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com:
 On Wed, Oct 19, 2011 at 2:52 PM, Hans-Peter Diettrich
 drdiettri...@aol.com wrote:
 WndProc can preprocess *any* kind of messages, which must be handled in a
 non-standard way in a specific control, e.g. the TripleClick messages.
 WndProc finally calls Dispatch, to invoke the implemented message handler of
 the control, or DefaultHandler for all messages without assigned handlers.

 You can wait some days to see if anyone is against the change and if
 not (Vincent didn't like this as far as I remember, so it would be
 good to hear from him). If there is no answer in 1 week then you can
 send a patch to bug tracker where this can then be further discussed.

Since I hardly do any win32 programming for Lazarus anymore, I hardly
have to say anything anymore.

What I was against, is letting all windows messages bubble up from the
win32 widgetset interface into the LCL. I am more a proponent of only
passing those messages to the LCL what are handled by the LCL, not all
and very messages that the win32 widget generate.

I cannot remember having said about what the LCL should handle messages.

Vincent

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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Hans-Peter Diettrich

Vincent Snijders schrieb:


What I was against, is letting all windows messages bubble up from the
win32 widgetset interface into the LCL. I am more a proponent of only
passing those messages to the LCL what are handled by the LCL, not all
and very messages that the win32 widget generate.


IMO such a separation already exists. The WM messges are sent *to* 
(Windows) widgets, like widget-specific EM (Edit), BM (Button) etc. 
messages. A widget itself sends back *notification* messages (EN, 
BN...), for use in an application or in the VCL/LCL.


DoDi


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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Hans-Peter Diettrich

Felipe Monteiro de Carvalho schrieb:


I also don't understand the parallel or different WM..., LM..., CM... and
CN... message IDs. Is that separation related to messages handled (or not
handled) by widgets or by the LCL? Or have the LM... message IDs been added
only to prevent cyclic unit references?


LM messages are sent from the LCL-Widgetsets to the LCL, so they are
cross-platform. WM messages are only for Windows.


Since no message IDs exist for other platforms, I'd assume that the LM 
messages are equivalent to the WM IDs. But why new names for old names?


DoDi


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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Vincent Snijders
2011/10/19 Hans-Peter Diettrich drdiettri...@aol.com:
 Vincent Snijders schrieb:

 What I was against, is letting all windows messages bubble up from the
 win32 widgetset interface into the LCL. I am more a proponent of only
 passing those messages to the LCL what are handled by the LCL, not all
 and very messages that the win32 widget generate.

 IMO such a separation already exists. The WM messges are sent *to* (Windows)
 widgets, like widget-specific EM (Edit), BM (Button) etc. messages. A widget
 itself sends back *notification* messages (EN, BN...), for use in an
 application or in the VCL/LCL.

No, IIRC, currently every message that gets into the win32 message
handlers, is passed to the LCL.

Vincent

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


Re: [Lazarus] LCL Message handling

2011-10-19 Thread Hans-Peter Diettrich

Vincent Snijders schrieb:


What I was against, is letting all windows messages bubble up from the
win32 widgetset interface into the LCL. I am more a proponent of only
passing those messages to the LCL what are handled by the LCL, not all
and very messages that the win32 widget generate.

IMO such a separation already exists. The WM messges are sent *to* (Windows)
widgets, like widget-specific EM (Edit), BM (Button) etc. messages. A widget
itself sends back *notification* messages (EN, BN...), for use in an
application or in the VCL/LCL.


No, IIRC, currently every message that gets into the win32 message
handlers, is passed to the LCL.


Where do all the messages originate in the non-Windows widgetsets?
Aren't these generated by the widgetsets?
Any hints where I could find out more about details?

DoDi


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