Lazarus

Programming => General => Topic started by: Medhome on August 07, 2022, 04:23:32 pm

Title: datamodule
Post by: Medhome on August 07, 2022, 04:23:32 pm
Hi all,

     I wrote a procedure  sumField in form1 and I want to replace the last procedure corresponding to afterOpen event in datamodule of my application.

Can I connect the AfterOpen event on the DataModule from Form1? .

Regards
Med

Nb:
I did datamod.dataset.afteropen := sumfield  in form1   No success.

 
Title: Re: datamodule
Post by: jamie on August 07, 2022, 04:31:51 pm
Data module is just another UNIT, include the unit name in the list of units in your USES list of where you need to access it from.
Title: Re: datamodule
Post by: Medhome on August 07, 2022, 04:37:12 pm
The AfterOpen event  is fired in the datamodule not in form1! 
Title: Re: datamodule
Post by: bpranoto on August 07, 2022, 05:31:06 pm
I did datamod.dataset.afteropen := sumfield  in form1   No success.

try: datamod.dataset.afteropen := @form1.sumfield
Title: Re: datamodule
Post by: Medhome on August 08, 2022, 02:51:45 pm
HI bpranoto,

   That works.

     @sumfield   works also cause we are in form1 .

Thank you.

Med
TinyPortal © 2005-2018