TApplicationProperties callbacks lazarus / 31-LCL ---------------------------------------------------------------------- timppl · 2011-10-13 10:12 Hello all In tha app I am porting from delphi to lazarus/fpc on linux, TApplicationEvents has two callback events , OnActivate and OnMessage which are not available in the TApplicationProperties in the LCL ( which I believe is the recommended replacement for TApplicationEvents ). Is there any workround to add these callbacks in linux? Thanks Tim ---------------------------------------------------------------------- User137 · 2011-10-13 13:45 In the FormCreate or Project source you can set Application.OnActivate event to some custom class procedure(Sender: TObject) of object. No idea about OnMessage, it sounds like it wouldn't be crossplatform if it would exist. Windows and Linux OS messages may differ. ---------------------------------------------------------------------- Shebuka · 2011-10-13 13:55 Code: [Select]  TFrm_Main = class(TForm)    [...]   private     { private declarations }     procedure MyMessageHandler(var Message: TLMessage); message MESSAGE_YOU_NEED;  //from LMessages unit [...] or cut away final message... part to catch all of them err: this is for catching a particular/custom message. ---------------------------------------------------------------------- timppl · 2011-10-14 07:14 Thanks for that. Shebuka, will that code make MyMessage handler be called for all recieved messages? I was under the impression it had to be assigned to an event, similar to "  OnCreate = FormCreate" in the dfm file or equivalent in the .pas file Regards Tim ---------------------------------------------------------------------- Shebuka · 2011-10-14 13:01 For catching all messages this must do the work: Code: [Select]  TFrm_Main = class(TForm)      procedure WndProc(var Message: TLMessage); override;   [...]   private     { private declarations }   [...] procedure TFrm_Main.WndProc(var Message: TLMessage); begin   if not (csDesigning in ComponentState) then   begin     case Message.Msg of       LM_MOVE:         begin           // do something here         end;       LM_SIZE:         begin           // do something here         end;     end;   end;   inherited;      // important to forward messages do default handlers end;  You don't need to assign the procedure to anything.