Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-10

LCL Message handling

11 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho
to Hans-Peter Diettrich: Can somebody explain the purpose of e.g. WindowProc, WndProc and MainWndProc, in the LCL?…
Hans-Peter Diettrich 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

Reply by email

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

Reply by email

Felipe Monteiro de Carvalho
to Hans-Peter Diettrich: WndProc can preprocess *any* kind of messages, which must be handled in a non-standard…
Hans-Peter Diettrich 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

Reply by email

Vincent Snijders
to Felipe Monteiro de Carvalho

2011/10/19 Felipe Monteiro de Carvalho :

Show quoted text 11 lines
On Wed, Oct 19, 2011 at 2:52 PM, Hans-Peter Diettrich 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

Reply by email

Hans-Peter Diettrich
to Felipe Monteiro de Carvalho: On Wed, Oct 19, 2011 at 1:56 PM, Hans-Peter Diettrich Delphi compatibility. AFAIK WndProc…
Show quoted text 6 lines
On Wed, Oct 19, 2011 at 1:56 PM, Hans-Peter Diettrich 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.

Show quoted text 10 lines
> 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

Reply by email

Hans-Peter Diettrich
to Felipe Monteiro de Carvalho: On Wed, Oct 19, 2011 at 2:52 PM, Hans-Peter Diettrich You can wait some days to see if…
Show quoted text 7 lines
> 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

Reply by email

Hans-Peter Diettrich
to Vincent Snijders: 2011/10/19 Felipe Monteiro de Carvalho : Since I hardly do any win32 programming for…
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

Reply by email

Vincent Snijders
to Hans-Peter Diettrich

2011/10/19 Hans-Peter Diettrich :

Show quoted text 11 lines
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

Reply by email

Hans-Peter Diettrich
to Vincent Snijders
Show quoted text 11 lines
>> 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

Reply by email

Paul Ishenin
to Hans-Peter Diettrich: Since no message IDs exist for other platforms, I'd assume that the LM messages are…
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

Reply by email

Hans-Peter Diettrich
to Paul Ishenin
Show quoted text 6 lines
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

Reply by email