Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form event linking

Status
Not open for further replies.

filipe26

Programmer
Mar 17, 2003
152
PT
Hi.I have two forms and the event onformshow is the same that the other.What im trying to do is to do a linking.

I have in the form.onshow inverno the code .

And in the verao.onshow event i have inverno.onshow(verao) "verao as sender"

code in the inverno form is

with sender do
listbox.dosomething

But the listbox does always is the form inverno and not on the form verao

Why?
 
The modern approach to this might be to use a frame that contains a listbox, several forms can then share this, I haven't got up to speed on these myself so I can be 100% about that.
otherwise, it depends on what exactly you are doing, if you were just talking about code with no attached components then several forms can 'use' code in an untyped unit (.pas) file.
Components (e.g a listbox) are descendants of the forms they are on but you can refer to a component on any form from any other with form1.listbox1.etc, provided that you place the 'uses' clause in the implementation section of the code to avoid circular references.

e.g. this uses clause has untyped and typed modules
Code:
[blue]implementation[/blue]

uses Failed, StringUtils, D7Utils, waitfrm, txpromt;

Steve: Delphi a feersum engin indeed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top