Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Simple RemObjects demo
Sun, Jan 29 2012 6:29 PMPermanent Link

Robert Devine

See readme.txt in the server project folder.

You'll need RemObjectsSDK.js from your RO installation (currently
RemObjectsSDK_empty.js in the projects).

Cheers, Bob



Attachments: RemObjects Test.zip
Fri, Feb 3 2012 8:18 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bob,

<< See readme.txt in the server project folder. >>

Cool, you got it working anyway. Wink

I'm going to try and see if I can get the class methods added to the
compiler this weekend.  The compiler already handles them via the
constructors, so it isn't a big stretch to expand them to user-defined
methods.

--
Tim Young
Elevate Software
www.elevatesoft.com
Fri, Feb 3 2012 8:29 AMPermanent Link

Robert Devine

Hi Tim

>I'm going to try and see if I can get the class methods
>added to the compiler this weekend

That would be great. I've also got RemObjects DataAbstract working and
pulling DataTables back - in this case I just wrote a JS wrapper class
(something I'd also done for the RO demo as an alternative to modifying
the generated code). Not a big problem writing these wrappers but it'll
be good to keep it all in EWB.

I'd posted a question on the RO support groups and (slightly tongue in
cheek) suggested they write their JS clients in EWB. You never know
though... Smile

Cheers, Bob



On 03/02/2012 13:18, Tim Young [Elevate Software] wrote:
> Bob,
>
> << See readme.txt in the server project folder. >>
>
> Cool, you got it working anyway. Wink
>
> I'm going to try and see if I can get the class methods added to the
> compiler this weekend. The compiler already handles them via the
> constructors, so it isn't a big stretch to expand them to user-defined
> methods.
>
Fri, Feb 3 2012 3:41 PMPermanent Link

Claudio Piffer

+1

best regards

"Bob Devine"  ha scritto nel messaggio
news:043537E4-838F-4EB5-97DE-EDEDEE807020@news.elevatesoft.com...

Hi Tim

>I'm going to try and see if I can get the class methods
>added to the compiler this weekend

That would be great. I've also got RemObjects DataAbstract working and
pulling DataTables back - in this case I just wrote a JS wrapper class
(something I'd also done for the RO demo as an alternative to modifying
the generated code). Not a big problem writing these wrappers but it'll
be good to keep it all in EWB.

I'd posted a question on the RO support groups and (slightly tongue in
cheek) suggested they write their JS clients in EWB. You never know
though... Smile

Cheers, Bob



On 03/02/2012 13:18, Tim Young [Elevate Software] wrote:
> Bob,
>
> << See readme.txt in the server project folder. >>
>
> Cool, you got it working anyway. Wink
>
> I'm going to try and see if I can get the class methods added to the
> compiler this weekend. The compiler already handles them via the
> constructors, so it isn't a big stretch to expand them to user-defined
> methods.
>
Tue, Feb 7 2012 10:22 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bob,

The new Feb 7th build includes support for class methods, properties, and
variables.  Just prefix any member with the "class" keyword in order to use
them:

  TTestClass = class
     private
        class FTitle: String='This is a class variable';
     public
        class property Title: String read FTitle;
        class function ToString: String;
     end;

That should be enough to allow for any type of static member in a JS class.
If you have any problems with this, let me know.  I tested normal classes
pretty thoroughly, but not the combination of external classes and class
members, although it shouldn't make any difference.

<< I'd posted a question on the RO support groups and (slightly tongue in
cheek) suggested they write their JS clients in EWB. You never know
though... Smile>>

It's certainly possible. Smile

--
Tim Young
Elevate Software
www.elevatesoft.com
Thu, Feb 9 2012 7:35 PMPermanent Link

Robert Devine

Hi Tim

If I have some test JS as follows:

var EWBT = {
    TestObject : function TestObject()
    {
        this.Sum = function(A, B)
        {
            return A + B;
        };
        this.Title = 'TestObject_Title';
    },
    Title : 'EWBT_TestTitle'
};


I declare in EWB:

external TTestObject = class
  public
    function Sum(A, B: integer): integer;
    property Title: string read;
  end;

  external TEWBT = class
  public
    class function TestObject: TTestObject;
    property Title: string read;
  end;


In my form code I have:

var
   Form1: TForm1;
   external EWBT: TEWBT;
   TestObj: TTestObject;


And in the button handler:

Edit1.Text := EWBT.Title;
TestObj := EWBT.TestObject.Create;
iSum := TestObj.Sum(3, 5);
Edit2.Text := TestObj.Title;
Edit3.Text := IntToStr(iSum);

This works fine if I run it in the IDE, but if I run it from a separate
web server I get "TestObject undefined". Looking at the generated JS I have:

$t.tform1_edit1.teditcontrol_settext(EWBT.Title);
unitmain_testobj = tobject.create(new TestObject());  <--- Error here.

If I manually edit the JS to use new EWBT.TestObject() then it works
fine. So the Title property gets EWBT generated but not the TestObject()
constructor. Any idea what I'm doing wrong?

Cheers, Bob



On 07/02/2012 15:22, Tim Young [Elevate Software] wrote:
> Bob,
>
> The new Feb 7th build includes support for class methods, properties,
> and variables. Just prefix any member with the "class" keyword in order
> to use them:
>
> TTestClass = class
> private
> class FTitle: String='This is a class variable';
> public
> class property Title: String read FTitle;
> class function ToString: String;
> end;
>
> That should be enough to allow for any type of static member in a JS
> class. If you have any problems with this, let me know. I tested normal
> classes pretty thoroughly, but not the combination of external classes
> and class members, although it shouldn't make any difference.
>
> << I'd posted a question on the RO support groups and (slightly tongue
> in cheek) suggested they write their JS clients in EWB. You never know
> though... Smile>>
>
> It's certainly possible. Smile
>
Tue, Feb 14 2012 12:20 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bob,

<< If I manually edit the JS to use new EWBT.TestObject() then it works
fine. So the Title property gets EWBT generated but not the TestObject()
constructor. Any idea what I'm doing wrong? >>

Nothing, actually. Smile The problem here is that the EWB compiler is not
handling *class types* returned from functions correctly.  It should be
interpreting a returned class type from your class function, but it is
treating it like an instance.

I'll have a fix for this in the next build.

--
Tim Young
Elevate Software
www.elevatesoft.com
Thu, May 10 2012 12:16 PMPermanent Link

Matthew Jones

Just a quick thank you for this demo. Works fine as the basis for my app and server.
The only issue I have is that of security - but that is down to the RO SDK
JavaScript not supporting the channel encryption (it seems). I just need to work
out how to do it in the WB code.

/Matthew Jones/
Mon, Jun 4 2012 1:04 PMPermanent Link

EssKay

"Tim Young [Elevate Software]" wrote:

Bob,

<< If I manually edit the JS to use new EWBT.TestObject() then it works
fine. So the Title property gets EWBT generated but not the TestObject()
constructor. Any idea what I'm doing wrong? >>

Nothing, actually. Smile The problem here is that the EWB compiler is not
handling *class types* returned from functions correctly.  It should be
interpreting a returned class type from your class function, but it is
treating it like an instance.

I'll have a fix for this in the next build.

--
Tim Young
Elevate Software
www.elevatesoft.com



Can you please attach source code ?
Image