Delphi - Accessing a Frame object from a Form -


I need to run an action that is linked to a button (called SQLBTN) which is inside my app Frame is placed on 1, from Form 1.
I've included the frame in the Fter 1 usage, but can not be addressed in any way.
I Frame 1 SQLbtn TFrame1.SQLbtn TFrameSQLBtn etc. have tried, but can not get it.
I want to do something similar to 'SQLbtn.click' to run the event behind it.

How can anyone address any thoughts?

I'm not sure I understand your question correctly. It looks like you have a frame with a button (and either click on an action or button on the event handle) and this frame is sitting on a form. Now you have to programmatically click to click on that button Want to

Obviously you have to add the frame unit to the usage section of your form. You need an example of the frame, which should be taken to a form field of the frame type, e.g.

  TForm1 ... ... Frame 1: TFrame1; End;  

Then you can execute that code through any of the methods of Frame1.SQLbtn.Click . A better way would be to provide a public method on that frame that you can use with the form. You do not need to reach the button directly (there is an implementation description of the button frame, so that you can talk privately).

Edit After Explanation

I understand that you have the following scenario:

  TFrameForm1 ... ... Frame 1: TFrame1; End; TForm1 ... ... process something; End; Process TForm1.something; Start // to call a method on frame 1 which is at FrameForm1 end;  

Your best option is to transfer the code from the frame button onclick event handler to a different unit. This can be a data modal, or just another unit with a standalone process . After that you can call that code from both Form 1 and Frame 1 button event handler. Wenger has made this comment.

If this is not possible, for example, because processing requires access to other controls on frame 1, take the code to frame one (my original suggestion) in a new process:

  TFrame1 ... ... public process framestuff; End; Process TFrame1.framestuff; Start ... end; Process TFrame1.SQLbtnClick (Sender ...); Framstuff started; End;  

Now you will need to call that method from Form 1, you will need to reference the FrameForm1 for this. What you need to start manually (!) When you create TFrameForm1 in this example, the reference field is FFrameForm:

  TForm1 ... ... FFrameForm: TFrameForm1; Process something; End; Process TForm1.something; Start FrameForm.framestuff; End; Or, by default Delphi adds global variables for form units (auto form creation, project options / forms check) for all types. Then you do this:  
  TForm1.Something to process; Start FrameForm1. // if the name used for FrameForm1 global variable end is Delphi;  

There are certainly many other variations ...


Comments