Hi,
I observe different behaviour on Windows and MacOS when OnKeyPress event is triggered.
On Mac when the event is triggered the Text value is already changed and contains the Key which is pressed.
For example if I see in the edit the text 'Edit1' and then press the 'A' in the OnKeyPress event handler the 'A' is appended to the text. In Windows it is still the old text.
Is there any way to have the old value when key is pressed.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Edit1: TEdit;
procedure Edit1KeyPress(Sender: TObject; var Key: char);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: char);
begin
ShowMessage(Edit1.Text);
end;
end.
(I'm writing a custom control, so I want to handle it in the TCustomEdit descendant.)
Thanks
Lazarus 4.99 (rev main_4_99-369-g86db8d9f83) FPC 3.2.2 aarch64-darwin-cocoa
I built Lazarus for arm64 by myself. Not sure if this is related to that behaviour