Topic: Recognising events in script

Hi all,

I am working on a project that does a few lines of code but for A LOT of slightly different records. To handle this i have events for 256 images (onclick/mouseEnter/mouseLeave).

I have written all the code. but now I am finding myself clicking in the events window on the left for EVERY event to recognise it in the code and then clicking back to the form to do it all again. This 3 times per image, times 256 for all images. Its killing my wrist.

PLEASE tell me there is a way to have the program recognise ALL events in the code that correspond with an object.

Re: Recognising events in script

Oh, and also (I don't want to be rude here)

Your software doesn't have an Undo (ctrl-Z) function and it has caused some problems for me in the past so I would LOVE to see it in a next version!

Re: Recognising events in script

vandongen.m wrote:

Hi all,

I am working on a project that does a few lines of code but for A LOT of slightly different records. To handle this i have events for 256 images (onclick/mouseEnter/mouseLeave).

I have written all the code. but now I am finding myself clicking in the events window on the left for EVERY event to recognise it in the code and then clicking back to the form to do it all again. This 3 times per image, times 256 for all images. Its killing my wrist.

PLEASE tell me there is a way to have the program recognise ALL events in the code that correspond with an object.


You can use one event for all components, please attach your project, I'll check, what I can do for your project.

Dmitry.

Re: Recognising events in script

Sorry, I've been busy for a while!

Sending the project is a bit difficult (its 3 projects Frankensteined into 1 and they are dependant on each other through root folder. Also the project total is now 2,5GB)

I've tried alot of ways to do it but I think I can explain with a bit of script:
---------------------------------------------------------------------------------------------------

procedure Form1_in001_OnClick (Sender: TObject);
begin
      Form1.ShowRecord('Inkoopstelling', 1);
end;

procedure Form1_in001_OnMouseLeave (Sender: TObject);
begin
      Picture := TPicture.Create();
      Picture.LoadFromFile('.\Inkoopstellingen\pics\wit.jpg');
      Form1.in001.Picture := Picture;
      Form1.lokatielabel.Text := 'Kies Lokatie';
      Form1.lokatielabel.Enabled := False;

end;

procedure Form1_in001_OnMouseEnter (Sender: TObject);
begin
      Picture := TPicture.Create();
      Picture.LoadFromFile('.\Inkoopstellingen\pics\rood.jpg');
      Form1.in001.Picture := Picture;
      Form1.lokatielabel.Text := 'IN001';
      Form1.lokatielabel.Enabled := True;
end;

--------------------------------------------------------------------------------------------------------------

As you can see the script is not very complicated or long. The problem is in this little bit of script there are 3 events for 1 object/image (click/mousenter/mouseleave)

This is the script for 'IN001'. I have to make IN001 to IN256 if you see what i mean.... so for the code above I have to click the event 3 times to have it recognize the script that corresponds with it. Then I have to do that with 256 objects/images.

Re: Recognising events in script

You can use one event for all components. Just paste event name for all components in the Object Inspector, on the tab Event, example for event OnMouseLeave

Form1_in001_OnMouseLeave

As you can see, in the event you have param Sender, so you can use this object to recognize which component send the event. Instead name of component (Form1.in001), you can use this way: TdbImage(Sender)


so instead

Form1.in001.Picture := Picture;

you should write

TdbImage(Sender).Picture := Picture;
Dmitry.