How do i use events at design time in Smart Mobile Studio?

Am i missing something here? I purchased Smart Mobile Studio two days ago, and been trying its features. I would expected that it would at least emulate delphi’s event model. No?

Shouldn't I be able to click on a control and have access to an events tab (as we do for properties), and add a delphi style event, such as OnClick for a Button (which would then be translated into a javascript event). I would expect to see not only the OnClick event in my forms unit, but the button as well. Seems that there is no reference to the button either.

What am i missing?

I see how i can do it at runtime, but i still can’t fugure out how to do it at design time. Can someone please help me?

Runtime...

unit Form1;

interface

uses w3system, w3ctrls, w3forms, w3application;

type
 TForm1=class(TW3form)
 private
 { Private methods }
 FButton : TW3Button;
 protected
 { Protected methods }
 Procedure InitializeObject;override;
 Procedure FinalizeObject;override;
 Procedure StyleTagObject;override;
 end;

Implementation

Procedure TForm1.InitializeObject;
 Begin
 inherited;
 FButton:=TW3Button.Create(Self);
 FButton.Caption:=’Load’;
FButton.OnClick:=procedure (Sender : TObject)
 begin
 //do something
 end;
 End;

Procedure TForm1.FinalizeObject;
 Begin
 inherited;
 End;

Procedure TForm1.StyleTagObject;
 Begin
 inherited;
 StyleClass:=’TW3CustomForm’;
 End;

end.

Answers:

Answer

As of writing, the smart IDE does not support code generation for delegates (or event objects). But this is scheduled to be added.

It is important to understand that smart does not try to be another delphi. That would ruin the richness of both object pascal and javascript by imposing limitations. Instead the central function of the product is to replace javascript with object pascal - which in turn adds to javascript (things like interfaces, inheritance and more).

At present, writing mobile apps is a bit of a black art. Freepascal users do their work by code only, as does C# developers (although we used to connect to the xcode designer .nib files) and naturally also javascript developers. Smart mobile, while it does require you to write more code, is still way ahead of the average javascript developer.

The time saving factor is that you dont have to write it all using javascript, but rather in a language you already know and love.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.