I can "get the kind of widget 1" which helpfully provides the necessary widget identifier (e.g. "com.livecode.widget.colorswatch"). For other object types I can "get the properties" - but seemingly not for widgets. Is there a command that allows me to easily access a widget's properties?
Also, is there a way to list the handlers to which a widget of any specified kind will respond in LCS (e.g. mouseup, dragstart, etc)? I know that viewing the LCB script will allow me to figure this out, but it would be great to be able to list all active widget handlers at a glance.
Getting properties and active handlers of a widget
-
- Livecode Staff Member
- Posts: 192
- Joined: Thu Apr 18, 2013 2:48 pm
Re: Getting properties and active handlers of a widget
There is currently no engine function to get either of these, although they can both obtained by parsing some additional files.
The complete list of handlers implemented in a widget is available in its 'interface' file. This is located at revIDESpecialFolderPath("Toolchain") & "/modules/lci/<extensionID>.lci". I think it would be a good idea for this to be documented for convenience, perhaps in the widget's user guide (these do not exist yet), or somewhere in the dictionary entry.
The list of properties a widget implements can be found in its manifest.xml file, which is located at revIDESpecialFolderPath("Extensions") & "/<extensionID>/manifest/xml", although as these are parsed already by the IDE when an extension is loaded, you can get the list using the revIDEExtensionProperties(<extensionID>) function, eg
put the keys of (revIDEExtensionProperties("com.livecode.widget.treeView"))
The complete list of handlers implemented in a widget is available in its 'interface' file. This is located at revIDESpecialFolderPath("Toolchain") & "/modules/lci/<extensionID>.lci". I think it would be a good idea for this to be documented for convenience, perhaps in the widget's user guide (these do not exist yet), or somewhere in the dictionary entry.
The list of properties a widget implements can be found in its manifest.xml file, which is located at revIDESpecialFolderPath("Extensions") & "/<extensionID>/manifest/xml", although as these are parsed already by the IDE when an extension is loaded, you can get the list using the revIDEExtensionProperties(<extensionID>) function, eg
put the keys of (revIDEExtensionProperties("com.livecode.widget.treeView"))
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Getting properties and active handlers of a widget
Here's how I'm getting the handlers currently:
Code: Select all
/**
* find the extension interfaces folder
*/
private function modulesLocation
return specialfolderpath("engine") & "/Toolchain/modules/lci/"
end modulesLocation
/**
* given a module name
* return a list of its public handlers
*/
function widgetAvailableHandlersOfModule pModule
local tFile
local tContents
put modulesLocation() & "com.livecode." & pModule & ".lci" into tFile
put url ("file:" & tFile) into tContents
filter tContents with "*handler*"
return tContents
end widgetAvailableHandlersOfModule
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Getting properties and active handlers of a widget
because note that revIDEspecialFolderpath("engine") returns nothing on linux.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev