Recent

Author Topic: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented  (Read 6764 times)

PeterX

  • Sr. Member
  • ****
  • Posts: 404
CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« on: June 06, 2017, 09:46:44 am »
Hi all,

while translating units from ol' Delphi 5 to Lazarus
I have some units where Lazarus complains about
"CM_DIALOGCHAR / CM_DIALOGKEY is not implemented"

Can I simply ignore that ?
(as long as there is no expicit code that does special things ..)

Where or better how does Lazarus handle these things ?
usually using latest Lazarus release version with Windows 10

PeterX

  • Sr. Member
  • ****
  • Posts: 404
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #1 on: June 07, 2017, 11:04:27 pm »
"CM_DIALOGCHAR / CM_DIALOGKEY is not implemented"

How does LAZARUS handle these things - instead of Delphi ?
usually using latest Lazarus release version with Windows 10

ASerge

  • Hero Member
  • *****
  • Posts: 2242
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #2 on: June 08, 2017, 05:55:35 pm »
How does LAZARUS handle these things - instead of Delphi ?
What is "these things"? Lazarus uses a different method to preview the key and does not use CM_DIALOGCHAR. For example, see TWinControl.DoKeyDownBeforeInterface.

PeterX

  • Sr. Member
  • ****
  • Posts: 404
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #3 on: June 09, 2017, 09:24:34 am »
Lazarus uses a different method to preview the key and does not use CM_DIALOGCHAR.
For example, see TWinControl.DoKeyDownBeforeInterface.
I'm working on converting an old Delphi 5 project where some
custom made components do use CM_DIALOGCHAR / CM_DIALOGKEY.
It will take some time to find out what the original author wanted to do with these messages.

I will have a look at this TWinControl.DoKeyDownBeforeInterface !
Maybe I can make "these things" working in lazarus.

For example ..
Code: Pascal  [Select][+][-]
  1. procedure TMySpeedButton.CMDialogChar(var aMessage: TCMDialogChar);
  2. begin
  3.   with aMessage do
  4.     if IsAccel(CharCode, Caption) and CanFocus then
  5.     begin
  6.       Click;
  7.       Result := 1;
  8.     end else
  9.       inherited;
  10. end;
  11.  
usually using latest Lazarus release version with Windows 10

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #4 on: June 09, 2017, 09:31:06 am »
As far as I remember cm_dialogchar/cm_dialogkey are delphi messages (all cm_XXXX are delphi messages not system) that are used to manage accelerator characters, accelerator characters are the underlined characters you see on the menus/buttons/labels the ones that you can define using the "&" before the accelerator character in the caption of a control. This are supposed to be chained and both answer the question is it an accelerator and process the accelerator if its.

Well memory not being what it used to be take it with a grain of salt.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

PeterX

  • Sr. Member
  • ****
  • Posts: 404
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #5 on: June 09, 2017, 10:26:52 am »
As far as I remember cm_dialogchar/cm_dialogkey are delphi messages (all cm_XXXX are delphi messages not system) that are used to manage accelerator characters, accelerator characters are the underlined characters you see on the menus/buttons/labels the ones that you can define using the "&" before the accelerator character in the caption of a control. This are supposed to be chained and both answer the question is it an accelerator and process the accelerator if its.

Well memory not being what it used to be take it with a grain of salt.

Probably I can handle it in procedure WMKeyDown(), under Lazarus ?
usually using latest Lazarus release version with Windows 10

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #6 on: June 09, 2017, 10:57:44 am »
For example ..
Code: Pascal  [Select][+][-]
  1. procedure TMySpeedButton.CMDialogChar(var aMessage: TCMDialogChar);
  2. begin
  3.   with aMessage do
  4.     if IsAccel(CharCode, Caption) and CanFocus then
  5.     begin
  6.       Click;
  7.       Result := 1;
  8.     end else
  9.       inherited;
  10. end;
  11.  
I just tested it: TSpeedButton supports accelerator keys out of the box. You can safely ignore this one.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #7 on: June 09, 2017, 05:20:33 pm »
As far as I remember cm_dialogchar/cm_dialogkey are delphi messages (all cm_XXXX are delphi messages not system) that are used to manage accelerator characters, accelerator characters are the underlined characters you see on the menus/buttons/labels the ones that you can define using the "&" before the accelerator character in the caption of a control. This are supposed to be chained and both answer the question is it an accelerator and process the accelerator if its.

Well memory not being what it used to be take it with a grain of salt.

Probably I can handle it in procedure WMKeyDown(), under Lazarus ?
I'm sorry I don't recall (and I have no access to a delphi installation at the moment to check) how are those messages generated. If you only need to react on acceleration characters you can use the keypress or keyup message I wouldn't use the key down.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

PeterX

  • Sr. Member
  • ****
  • Posts: 404
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #8 on: June 12, 2017, 10:33:16 pm »
I'm sorry I don't recall (and I have no access to a delphi installation at the moment to check) how are those messages generated. If you only need to react on acceleration characters you can use the keypress or keyup message I wouldn't use the key down.

Thanks, that's a statement !

I'll try this and probably I can fully rescue these old components this way, for me ..
usually using latest Lazarus release version with Windows 10

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1314
    • Lebeau Software
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #9 on: June 13, 2017, 08:57:41 pm »
I'm sorry I don't recall (and I have no access to a delphi installation at the moment to check) how are those messages generated.

See the following article on EDN:

A Key’s Odyssey

Quote
Abstract: This article follows the path of a keystroke message through the VCL. You will learn how the key processing is implemented, how the OnKey events work and what intervention points for the programmer can be found in the whole process. In addition, things like message processing are explained, and you will learn how to trace messages in the debugger from the message loop to their eventual destination.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: CM_DIALOGCHAR / CM_DIALOGKEY is not implemented
« Reply #10 on: June 14, 2017, 07:18:35 am »
I'm sorry I don't recall (and I have no access to a delphi installation at the moment to check) how are those messages generated.

See the following article on EDN:

A Key’s Odyssey

Quote
Abstract: This article follows the path of a keystroke message through the VCL. You will learn how the key processing is implemented, how the OnKey events work and what intervention points for the programmer can be found in the whole process. In addition, things like message processing are explained, and you will learn how to trace messages in the debugger from the message loop to their eventual destination.
thanks I'll take a look.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018