Hi !<div>I have an application who does something like your app does.</div><div>I guess you should generate the PAS file together DFM, generating declarations and skeleton implementations of the event's procedures there.<br>
It works for me !!</div><div><br><div class="gmail_quote">2010/9/16 John Bird <span dir="ltr"><<a href="mailto:johnkbird@paradise.net.nz">johnkbird@paradise.net.nz</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I have a source generation program to speed creating of sets of labels and<br>
edit boxes on a form - which gives output like examples below.<br>
<br>
I paste the code that goes in the DFM onto the form, and it creates all the<br>
components - a neat Delphi trick for those who might not know.<br>
<br>
My problem is that the OnEnter and OnExit events seem to disappear from<br>
these components and I have to add them back manually, even though the code<br>
was already in the unit when the paste was done. My detective work so far<br>
seems to show that it depends on where the forward (first) declaration of<br>
the event code is placed whether it is recognised or not - seems it has to<br>
be above the {private} and {public} sections for the form<br>
<br>
What are the rules for where such event code has to be declared? - I am<br>
vague on this. I have heard others use generated code too, I am wondering<br>
if they have tips or pitfalls like this to avoid.<br>
<br>
(Aside - Personally I favour source generation like this a lot. It is cool<br>
to do, ends up as fast as hand written code, and most importantly saves time<br>
and introduces standard code structure that is easy to understand.)<br>
(Further aside - this is code generated by the program for a new part of<br>
itself. Its cool when a program can write its own code).<br>
<br>
example of output from the code generation....<br>
<br>
// Forward declaration<br>
procedure edtSOURCEINPUTEnter(Sender: TObject);<br>
procedure edtSOURCEINPUTExit(Sender: TObject);<br>
<br>
<br>
//Implementation ------- edit enter and exit events for editing this<br>
record --------<br>
procedure Tform1.edtSOURCEINPUTEnter(Sender: TObject);<br>
begin<br>
(some code here)<br>
end;<br>
<br>
procedure Tform1.edtSOURCEINPUTExit(Sender: TObject);<br>
begin<br>
(some code here)<br>
end;<br>
<br>
And:<br>
<br>
//Paste onto form<br>
<br>
object lblSrcInpPath: TLabel<br>
Left = 300<br>
Top = 51<br>
Width = 142<br>
Height = 13<br>
Caption = 'Path'<br>
Font.Charset = DEFAULT_CHARSET<br>
Font.Color = clBlack<br>
Font.Height = -11<br>
Font.Name = 'MS Sans Serif'<br>
Font.Style = []<br>
ParentFont = False<br>
end<br>
object edtSrcInpPath: TEdit<br>
Left = 420<br>
Top = 48<br>
Width = 121<br>
Height = 21<br>
Font.Charset = DEFAULT_CHARSET<br>
Font.Color = clNavy<br>
Font.Height = -11<br>
Font.Name = 'Tahoma'<br>
Font.Style = [fsBold]<br>
ParentFont = False<br>
TabOrder = 1<br>
Text = ''<br>
Enabled = True<br>
OnEnter = edtSOURCEINPUTEnter<br>
OnExit = edtSOURCEINPUTExit<br>
end<br>
object lblSrcInpFileIn: TLabel<br>
Left = 300<br>
Top = 75<br>
Width = 142<br>
Height = 13<br>
Caption = 'Filename without path'<br>
Font.Charset = DEFAULT_CHARSET<br>
Font.Color = clBlack<br>
Font.Height = -11<br>
Font.Name = 'MS Sans Serif'<br>
Font.Style = []<br>
ParentFont = False<br>
end<br>
object edtSrcInpFileIn: TEdit<br>
Left = 420<br>
Top = 72<br>
Width = 121<br>
Height = 21<br>
Font.Charset = DEFAULT_CHARSET<br>
Font.Color = clNavy<br>
Font.Height = -11<br>
Font.Name = 'Tahoma'<br>
Font.Style = [fsBold]<br>
ParentFont = False<br>
TabOrder = 2<br>
Text = ''<br>
Enabled = True<br>
OnEnter = edtSOURCEINPUTEnter<br>
OnExit = edtSOURCEINPUTExit<br>
end<br>
<br>
etc....<br>
<br>
<br>
John<br>
<br>
<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br>
</blockquote></div><br></div>