Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Missing something...?
Tue, Dec 13 2011 9:42 AMPermanent Link

Robert Devine

If I create a form and implement one or more event handlers I can see
those handlers in the generated JavaScript. However, if I do something
like the following, then the ShowTestMessage procedure is not visible in
the generated Javascript.

This also happens if I create a non-visual class and add some methods -
there's no sign of them in the JS. Bug or am I missing something?

Cheers, Bob


TForm1 = class(TForm)
      Label1: TLabel;
      Button1: TButton;
      Edit1: TEdit;
      DataSet1: TDataSet;
      procedure Button1Click(Sender: TObject);
   private
      { Private declarations }
   public
      { Public declarations }
      procedure ShowTestMessage;
   end;


// -- The following handler is auto-generated.
procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := 'This is a test';
end;

// -- The following procedure is hand-coded.
procedure TForm1.ShowTestMessage;
begin
  Edit1.Text := 'ShowTestMessage';
end;
Tue, Dec 13 2011 10:07 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bob,

<< If I create a form and implement one or more event handlers I can see
those handlers in the generated JavaScript. However, if I do something like
the following, then the ShowTestMessage procedure is not visible in the
generated Javascript.

This also happens if I create a non-visual class and add some methods -
there's no sign of them in the JS. Bug or am I missing something? >>

Are you actually calling the ShowTestMessage procedure anywhere in your
application ?  If not, then the compiler will remove it during the emitting
stage.

--
Tim Young
Elevate Software
www.elevatesoft.com
Tue, Dec 13 2011 10:12 AMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate


You need to use it for it to be included - one of the benefits of EWB
that Tim has listed is that only stuff that results in a valid codepath
gets compiled into javascript - thus minimizing your JS file size.

Do something like this and it should be included.

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := 'This is a test';
  ShowTestMessage;
end;


Raul


On 12/13/2011 9:42 AM, Bob Devine wrote:
> If I create a form and implement one or more event handlers I can see
> those handlers in the generated JavaScript. However, if I do something
> like the following, then the ShowTestMessage procedure is not visible in
> the generated Javascript.
>
> This also happens if I create a non-visual class and add some methods -
> there's no sign of them in the JS. Bug or am I missing something?
>
> Cheers, Bob
>
>
> TForm1 = class(TForm)
> Label1: TLabel;
> Button1: TButton;
> Edit1: TEdit;
> DataSet1: TDataSet;
> procedure Button1Click(Sender: TObject);
> private
> { Private declarations }
> public
> { Public declarations }
> procedure ShowTestMessage;
> end;
>
>
> // -- The following handler is auto-generated.
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> Edit1.Text := 'This is a test';
> end;
>
> // -- The following procedure is hand-coded.
> procedure TForm1.ShowTestMessage;
> begin
> Edit1.Text := 'ShowTestMessage';
> end;
Tue, Dec 13 2011 10:28 AMPermanent Link

Robert Devine

Thanks Tim/Raul - I missed that.

Cheers, Bob


On 13/12/2011 15:07, Tim Young [Elevate Software] wrote:
> Bob,
>
> << If I create a form and implement one or more event handlers I can see
> those handlers in the generated JavaScript. However, if I do something
> like the following, then the ShowTestMessage procedure is not visible in
> the generated Javascript.
>
> This also happens if I create a non-visual class and add some methods -
> there's no sign of them in the JS. Bug or am I missing something? >>
>
> Are you actually calling the ShowTestMessage procedure anywhere in your
> application ? If not, then the compiler will remove it during the
> emitting stage.
>
Image