How to use events during development in Smart Mobile Studio?

Am I missing something here? I bought Smart Mobile Studio two days ago and tried to use its features. I expected it to at least emulate a delphis event model. Not?

Is it possible to click on a control and have access to the events tab (as well as for properties) and add a delphi style event, for example, OnClick for a button (which will then be translated into javascript). I would expect to see not only the OnClick event in my forms module, but also the button. There seems to be no link to the button.

What am I missing?

I see how I can do this at runtime, but I still can't figure out how to do this at design time. Can someone please help me?

Lead time...

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. 
+6
source share
1 answer

Since writing, the IDE does not support code generation for delegates (or event objects). But it is planned to add.

It is important to understand that smart is not trying to be another delphi. This will destroy the wealth of both the pascal and javascript objects by imposing restrictions. Instead, the central function of the product is to replace javascript with a pascal object, which in turn adds javascript (things like interfaces, inheritance, etc.).

Writing mobile apps now is a bit of a black art. Freepascal users do their work only by code, as do the C # developers (although we used xcode for the .nib designer) and, of course, also javascript developers. Smart mobile, while this requires writing more code, is still ahead of the average javascript developer.

A time-saving factor is that you do not need to write everything using javascript, but rather in the language that you already know and love.

+4
source

Source: https://habr.com/ru/post/916103/


All Articles