Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread TLink Loses OnClick Event.
Wed, Jul 22 2015 8:48 PMPermanent Link

Steve Gill

Avatar

Hi Tim,

I am currently using TLink as menu items in my web apps.  

I have noticed something odd is happening when I make an unrelated change on a form.  TLink seems to lose the connection to the OnClick event.  

The events are still there and all I need to do is go into the object inspector and double-click on the OnClick event for each TLink to bring them back.

The worst thing is it doesn't happen all the time - it's intermittent.

= Steve
Wed, Jul 22 2015 9:59 PMPermanent Link

Raul

Team Elevate Team Elevate

On 7/22/2015 8:48 PM, Steve Gill wrote:
> Hi Tim,
> I am currently using TLink as menu items in my web apps.
> I have noticed something odd is happening when I make an unrelated change on a form.  TLink seems to lose the connection to the OnClick event.
> The events are still there and all I need to do is go into the object inspector and double-click on the OnClick event for each TLink to bring them back.
> The worst thing is it doesn't happen all the time - it's intermittent.

Are you by any chance modifying any code in the interface section that
IDE maintains ?  I found it can cause issues like this.

For example i can duplicate missing event issue like this fairly
consistently :

1. new project, based on TForm,
2. add TButton and TLink
3. add OnClick handler for both and fill in event implemention with
something ( i used Showmessage dialog for both).

4. Go into the form interface section where Button1 and Link1 are
defined and enter something invalid between component declartions and
event ones. I did this (note the two "a" in there ) :

   TForm1 = class(TForm)
      Button1: TButton;
      a
      Link1: TLink;
      a
      procedure Button1Click(Sender: TObject);
      procedure Link1Click(Sender: TObject);

5. When you now hit save then OnClick handlers are removed from object
inspector for both TButton and TLink.


Raul


Thu, Jul 23 2015 12:51 AMPermanent Link

Steve Gill

Avatar

Hi Raul,

<< Are you by any chance modifying any code in the interface section that
IDE maintains ?  I found it can cause issues like this. >>

Yes, I'm pretty sure I have added new units to the Uses clause, and new methods to the Private/Public sections.

= Steve
Thu, Jul 23 2015 9:21 AMPermanent Link

Raul

Team Elevate Team Elevate

On 7/23/2015 12:51 AM, Steve Gill wrote:
> Yes, I'm pretty sure I have added new units to the Uses clause, and new methods to the Private/Public sections.

I generally had not noticed these issues when using regular private and
public sections of a class (only the ide maintained one befopre the
private section).

However i did run some more tests and as long as you have multiple
uncompilable entries it causes issues. Having this in the class private
and public results in lost handlers again:

   private
      { Private declarations }
      myVar1
      myVar2:integer;
      myVar3
   public
      { Public declarations }
      myVar4
      myVar5


If i have less entries or do not have not have the valid variable
definition in the middle there it does not cause the issue.

Second issue (related but separate) is that if you add event handler now
(without fixing the private/public section first) it inserts it in the
wrong place - for example inside the existing onclick handler (but can
be in other places as well).

I ended up with this for example:

procedure TForm1.Button1Click(Sender: TObject);
begin
   showmessage('button');

procedure TForm1.Button1Click(Sender: TObject);
begin

end;

end;

Raul




Thu, Jul 23 2015 5:55 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< I have noticed something odd is happening when I make an unrelated change on a form.  TLink seems to lose the connection to the OnClick event. >>

This will be fixed in 2.01.  The issue occurs when you try to save the form/unit and there is a compilation/parsing issue in the implementation section of the unit.  2.01 changes the way that EWB looks for empty event handlers and stops using the implementation section for determining their "existence".

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jul 23 2015 11:59 PMPermanent Link

Steve Gill

Avatar

<< ....If i have less entries or do not have not have the valid variable
definition in the middle there it does not cause the issue.

Second issue (related but separate) is that if you add event handler now
(without fixing the private/public section first) it inserts it in the
wrong place - for example inside the existing onclick handler (but can
be in other places as well)......>>

Keeps us on our toes, I guess. Smile
Thu, Jul 23 2015 11:59 PMPermanent Link

Steve Gill

Avatar

<< This will be fixed in 2.01.  The issue occurs when you try to save the form/unit and there is a compilation/parsing issue in the implementation section of the unit.  2.01 changes the way that EWB looks for empty event handlers and stops using the implementation section for determining their "existence". >>

Thanks Tim.
Image