Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libraries vs Widgets #53

Open
mwieder opened this issue Feb 28, 2023 · 5 comments
Open

Libraries vs Widgets #53

mwieder opened this issue Feb 28, 2023 · 5 comments

Comments

@mwieder
Copy link

mwieder commented Feb 28, 2023

Not sure where to put this, but I think it's important in understanding LCB:

There are two types of extensions: libraries and widgets. The two have almost no points in common.
Library extensions are for importing into other extensions with the "use" command. This is normally done in widget code, but if necessary a library can consume another library. I've never seen this in the wild, but it seems possible.
If you "use" a library then its handlers are available to the encompassing script, much in the same way as frontscripts, backscripts, library scripts, and behaviors.
Libraries can not be referenced by name, id, etc, so they can not have properties. Only widgets have properties that are accessible externally and via the Property Inspector.
Widgets are self-contained, so you can not call their handlers from outside the widget. You can only externally call handlers contained in a library. Thus the onSave handler in a widget is only invoked on a save event... you can't send an "onSave" or "save" message to a widget. Dispatching a handler to a widget results in it being "unhandled".
There appears to be a limited number of canned events to create handlers for, and it's unclear whether more event handlers can be added.

@macMikey
Copy link
Owner

macMikey commented Mar 2, 2023

Well, we have a wiki page on libraries, but i don't have a page on widgets, yet.
thoughts?

@mwieder
Copy link
Author

mwieder commented Mar 3, 2023

That bug report is very interesting. I think it implies that the act of compiling an LCB script makes it compatible at a bytecode level with a compiled LCS script. And I need to brain that a bit before I can figure out what that means.

@mwieder
Copy link
Author

mwieder commented Mar 3, 2023

There are also references to things like OnClose handlers, and I don't know if there is a limited set of possible event handlers and it's just undocumented, or if you can make new ones for internal messages.

@mwieder
Copy link
Author

mwieder commented Mar 3, 2023

...and (yet more) the foreign handlers interface can use several builtin types (Boolean, String, etc) but the examples use things like CBool and CUInt, but they aren't documented anywhere. I could (and do) assume that Boolean = CBool but I'd also like a double type and a Point type. I tried using a CUInt32 type but it doesn't exist. Would be nice to have documentation, especially since these are used in the User Guide. And there's a Pointer type, but it's just generic - you can't point it to anything specific.

@macMikey
Copy link
Owner

macMikey commented Mar 3, 2023

Welcome to the project.
sigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants