Do widgets support introspection?

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Do widgets support introspection?

Graham Samuel via use-livecode
Is there a way, given a widget, to find out programmatically what the
relevant properties of the widget are?
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
> G.C. wrote:
> Is there a way, given a widget, to find out programmatically what the
> relevant properties of the widget are?

Only the documented ones.
Even the property inspector shows only the "user_visible" ones.
The only possibility I can see is to scan the lcb file (if it is available).

So, if somebody doesn't document the properties and the widget is not "open source" then you get nothing, whether programatically or not.



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 01/09/2018 08:25 PM, hh via use-livecode wrote:
>> G.C. wrote:
>> Is there a way, given a widget, to find out programmatically what the
>> relevant properties of the widget are?
>
> Only the documented ones.
> Even the property inspector shows only the "user_visible" ones.
> The only possibility I can see is to scan the lcb file (if it is available).
>
> So, if somebody doesn't document the properties and the widget is not "open source" then you get nothing, whether programatically or not.

Might be easier to examine the manifest.xml file for the properties.
At least via a script.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
Do the built-in widgets come with manifests?

On Tue, Jan 9, 2018 at 11:36 PM, Mark Wieder via use-livecode <
[hidden email]> wrote:
>
> Might be easier to examine the manifest.xml file for the properties.
> At least via a script.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 01/09/2018 09:45 PM, Geoff Canyon via use-livecode wrote:
> Do the built-in widgets come with manifests?

Yes. Even the built-in widgets. At least for now, until we get
commercial locked widgets.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 2018-01-10 08:52, Mark Wieder via use-livecode wrote:
> On 01/09/2018 09:45 PM, Geoff Canyon via use-livecode wrote:
>> Do the built-in widgets come with manifests?
>
> Yes. Even the built-in widgets. At least for now, until we get
> commercial locked widgets.

Why would 'commercial locked widgets' not have a manifest? (Or some
other means to describe their public interface...)

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 01/10/2018 12:57 AM, Mark Waddingham via use-livecode wrote:

> Why would 'commercial locked widgets' not have a manifest? (Or some
> other means to describe their public interface...)

Dunno. It's a mystery to me. I'm just working off Ali's comments in the
PR. Can you guarantee then that widgets must always be distributed with
a manifest.xml file? Or equivalent?

https://github.com/livecode/livecode-ide/commit/397deb26d7c0f93d4461bb36e292f8bafd5b0a5c

http://forums.livecode.com/viewtopic.php?f=67&t=30264

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 2018-01-10 18:34, Mark Wieder via use-livecode wrote:
> Dunno. It's a mystery to me. I'm just working off Ali's comments in
> the PR. Can you guarantee then that widgets must always be distributed
> with a manifest.xml file? Or equivalent?
>
> https://github.com/livecode/livecode-ide/commit/397deb26d7c0f93d4461bb36e292f8bafd5b0a5c
>
> http://forums.livecode.com/viewtopic.php?f=67&t=30264

I can't guarantee there will be a separate file in the future
necessarily, nor something human-readable (the manifest.xml is actually
generated mechanically from the data in the compiled module file and
combined with the metadata statements in the source file).

However, as has been highlighted here, we do need to add a nice, simple,
stable API which returns an array describing a control's public API to
the IDE library. There is an API which does it in a form suitable for
the property inspector, but that's not quite as succinct.

So I can guarantee we will add a function 'ideDescribeControl' or some
such which would return an array listing the controls properties with
full type information and associated metadata so plugins don't have to
rely on fettling with internal details.

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On Wed, Jan 10, 2018 at 12:44 PM, Mark Waddingham via use-livecode <
[hidden email]> wrote:

> There is an API which does it in a form suitable for the property
> inspector, but that's not quite as succinct.
>

​Is this script-accessible, or just engine-accessible?​
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 2018-01-10 18:49, Geoff Canyon via use-livecode wrote:
> On Wed, Jan 10, 2018 at 12:44 PM, Mark Waddingham via use-livecode <
> [hidden email]> wrote:
>
>> There is an API which does it in a form suitable for the property
>> inspector, but that's not quite as succinct.
>>
>
> ​Is this script-accessible, or just engine-accessible?​

Script accessible - its part of the IDE library.

I chatted to Ali about this first thing this morning...

`revIDEPropertiesInfo pObjectList` returns an array of obj property info
that is shared between the objects in the list. Although that's in a
processed form required by the property inspector.

The info will be that required by the property inspector - which is
probably suitable for Navigator (which I'm assuming is what you are
looking to update :)).

Adding a non-property-inspector-specific describe API is on the list of
things to do :)

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
In reply to this post by Graham Samuel via use-livecode
On 2018-01-10 18:34, Mark Wieder via use-livecode wrote:
> On 01/10/2018 12:57 AM, Mark Waddingham via use-livecode wrote:
>
>> Why would 'commercial locked widgets' not have a manifest? (Or some
>> other means to describe their public interface...)
>
> Dunno. It's a mystery to me. I'm just working off Ali's comments in
> the PR.

Are you sure you didn't confuse 'source file' with 'manifest' - its
dealing with no source file in extensions that commit sorts out (also
why protected extensions need their docs extracted at build time -
there's no source file in them for the IDE to poke).

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
In reply to this post by Graham Samuel via use-livecode
On Wed, Jan 10, 2018 at 12:54 PM, Mark Waddingham via use-livecode <
[hidden email]> wrote:


> The info will be that required by the property inspector - which is
> probably suitable for Navigator (which I'm assuming is what you are looking
> to update :)).
>

​Get out of my head! ;-)​
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
In reply to this post by Graham Samuel via use-livecode
On 01/10/2018 09:44 AM, Mark Waddingham via use-livecode wrote:

> I can't guarantee there will be a separate file in the future
> necessarily, nor something human-readable (the manifest.xml is actually
> generated mechanically from the data in the compiled module file and
> combined with the metadata statements in the source file).
>
> However, as has been highlighted here, we do need to add a nice, simple,
> stable API which returns an array describing a control's public API to
> the IDE library. There is an API which does it in a form suitable for
> the property inspector, but that's not quite as succinct.
>
> So I can guarantee we will add a function 'ideDescribeControl' or some
> such which would return an array listing the controls properties with
> full type information and associated metadata so plugins don't have to
> rely on fettling with internal details.

I'm currently relying on the manifest.xml file in order to retrieve
information about widgets that seems unavailable elsewhere (distinction
between widget and library, svgicon data, etc). I'm trying to stay ahead
of the game by future-proofing my code, and it's a bit frustrating
trying to guess at things from PR comments. The existing
revDocsParseDocFileToLibraryArray function in revDocsParser doesn't
return much useful information about widgets (no metadata, etc).

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
In reply to this post by Graham Samuel via use-livecode
On 01/10/2018 09:56 AM, Mark Waddingham via use-livecode wrote:

> Are you sure you didn't confuse 'source file' with 'manifest' - its
> dealing with no source file in extensions that commit sorts out (also
> why protected extensions need their docs extracted at build time -
> there's no source file in them for the IDE to poke).

Yes. I'm looking at the __fetchScriptLibraryData function, which
attempts to retrieve information from the api.lcdoc file if there's no
manifest.xml file present. The .lcdoc files for widgets are quite
different from those for the dictionary (and with good reason), and much
useful information in the xml file is not present in the lcdoc file. I'm
guessing that much needs to change for this to work as described.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
In reply to this post by Graham Samuel via use-livecode
I have to admit, having parsed the results of revIDEPropertiesInfo and
looked at   <property name="timeZone" get="optional number" set="optional
number"/>, it took me more than a few tries at:

set the timeZone of widget "clock" to 1
set the timeZone of widget "clock" to 5
set the timeZone of widget "clock" to 9

...etc. before I noticed that the second hand was glitching slightly and
tried

set the timeZone of widget "clock" to 3600

In the words of Gru, "Light bulb."

That said, there doesn't seem to be any info in either place that would
have led me in this direction, or more importantly, to specify acceptable
vs. unacceptable values for something like this. TBD?
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
In reply to this post by Graham Samuel via use-livecode
My guess is that will be for livecodescript libraries since they do not end
up with a manifest file.
On Wed, Jan 10, 2018 at 12:09 PM Mark Wieder via use-livecode <
[hidden email]> wrote:

> On 01/10/2018 09:56 AM, Mark Waddingham via use-livecode wrote:
>
> > Are you sure you didn't confuse 'source file' with 'manifest' - its
> > dealing with no source file in extensions that commit sorts out (also
> > why protected extensions need their docs extracted at build time -
> > there's no source file in them for the IDE to poke).
>
> Yes. I'm looking at the __fetchScriptLibraryData function, which
> attempts to retrieve information from the api.lcdoc file if there's no
> manifest.xml file present. The .lcdoc files for widgets are quite
> different from those for the dictionary (and with good reason), and much
> useful information in the xml file is not present in the lcdoc file. I'm
> guessing that much needs to change for this to work as described.
>
> --
>   Mark Wieder
>   [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
Brian is correct, this is a temporary use of the lcdoc stuff for script
libraries to contain info that would be contained in its manifest.

Rather than worrying about what information comes from where, it would
probably be best to use the revIDEExtensions function which returns all the
'metadata' associated with extensions (both lcb and lcs). Although
admittedly that doesn't yet contain information about public handlers in
script library extensions.

On Wed, Jan 10, 2018 at 6:18 PM Brian Milby via use-livecode <
[hidden email]> wrote:

> My guess is that will be for livecodescript libraries since they do not end
> up with a manifest file.
> On Wed, Jan 10, 2018 at 12:09 PM Mark Wieder via use-livecode <
> [hidden email]> wrote:
>
> > On 01/10/2018 09:56 AM, Mark Waddingham via use-livecode wrote:
> >
> > > Are you sure you didn't confuse 'source file' with 'manifest' - its
> > > dealing with no source file in extensions that commit sorts out (also
> > > why protected extensions need their docs extracted at build time -
> > > there's no source file in them for the IDE to poke).
> >
> > Yes. I'm looking at the __fetchScriptLibraryData function, which
> > attempts to retrieve information from the api.lcdoc file if there's no
> > manifest.xml file present. The .lcdoc files for widgets are quite
> > different from those for the dictionary (and with good reason), and much
> > useful information in the xml file is not present in the lcdoc file. I'm
> > guessing that much needs to change for this to work as described.
> >
> > --
> >   Mark Wieder
> >   [hidden email]
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 01/10/2018 12:37 PM, Ali Lloyd via use-livecode wrote:
> Brian is correct, this is a temporary use of the lcdoc stuff for script
> libraries to contain info that would be contained in its manifest.
>
> Rather than worrying about what information comes from where, it would
> probably be best to use the revIDEExtensions function which returns all the
> 'metadata' associated with extensions (both lcb and lcs). Although
> admittedly that doesn't yet contain information about public handlers in
> script library extensions.

Thanks for that! revIDEExtensions() looks almost useful. Is there
something similar for user extensions? Is this function going to be
documented some day?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
revIDEExtensions gives info on all the installed extensions, user or
otherwise (I guess it's the revIDE prefix that makes it sound like it
doesn't).

Yes, it is going to be documented some day! Hopefully when there are more
resources available to sort out documenting the IDE.


On Wed, Jan 10, 2018 at 9:17 PM Mark Wieder via use-livecode <
[hidden email]> wrote:

> On 01/10/2018 12:37 PM, Ali Lloyd via use-livecode wrote:
> > Brian is correct, this is a temporary use of the lcdoc stuff for script
> > libraries to contain info that would be contained in its manifest.
> >
> > Rather than worrying about what information comes from where, it would
> > probably be best to use the revIDEExtensions function which returns all
> the
> > 'metadata' associated with extensions (both lcb and lcs). Although
> > admittedly that doesn't yet contain information about public handlers in
> > script library extensions.
>
> Thanks for that! revIDEExtensions() looks almost useful. Is there
> something similar for user extensions? Is this function going to be
> documented some day?
>
> --
>   Mark Wieder
>   [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Do widgets support introspection?

Graham Samuel via use-livecode
On 01/10/2018 01:52 PM, Ali Lloyd via use-livecode wrote:
> revIDEExtensions gives info on all the installed extensions, user or
> otherwise (I guess it's the revIDE prefix that makes it sound like it
> doesn't).

Yeah, I got thrown off by that and didn't dig down far enough to see the
user extensions in the mix. So iterating through

put revIDEExtensions() into tArray
repeat for each element tExtension in tArray
   put tExtension["ide"] into tIsBuiltIn
   ...

will distinguish between built-in and user extensions?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
12