[Pas2js] ui framework help with pas2js

mister highball mr.highball at hotmail.com
Tue Apr 28 05:43:51 CEST 2020

This is my first post to this mailing list, and just wanted to start out saying that I've been very much impressed using pas2js so far. I've been following the development for quite some time now, but I've just actually started to try and use the compiler.
I've been working on a UI framework since this seems to be something the community could use.

Here's the repo (it's in the infant stage)

The idea is to build the UI fluently in code, rather than rely on a traditional form editor. While there are some downsides, I believe the upsides are there too (UI changes can be checked in to git/diff'd, easy to see how things are hooked up, etc...).
Additionally, I'm building the framework to allow the same code to be used to produce browser apps as well as desktop apps. Because of this I rely heavy on interfaces and creation of objects via factories.

Now... here's my problem

I have this code which is the most basic example I could come up with to debug my library (adding a button)

  UI : INyxUI;

procedure BuildUI;
  I : Integer;
  LContainer: INyxContainer;
  UI := NewNyxUI;
  LContainer := NewNyxContainer; //** Here's the issue **

  //setup the ui with the demo ui components
    .AddContainer(LContainer, I) //add a container
Rather than returning my interface on that line (the one above works just fine, and constructs the UI object the same way), an exception gets thrown and leads me to rtl.js (line:687) which looks like this (latest version being used 1.4.20)

for (var id in this){
        if (this.hasOwnProperty(id)){
          //console.log('rtl.intfRefs.free: id='+id+' '+this[id].$name+' $o='+this[id].$o.$classname);
and throws, (Uncaught TypeError: Cannot read property '_Release' of null)

This easily could be an issue with my code, but in this case it seems like my reference is getting immediately freed after creation and am having a hard time seeing why. I am debugging in the browser (chrome variant) but still having a hard time spotting the issue.
I'm going to continue debugging this to see if I can gain some headway, but just didn't know if there were any known issues with

  *   interface reference counting
  *   object creation via metaclasses

Any insight would be appreciated!

Anyways, keep up the good work, and I'll be sure to post updates on the library when I have them

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20200428/b4479143/attachment.html>

More information about the Pas2js mailing list