LiveCode
  • Why LiveCode?
  • Customers
  • Resources
  • Education
  • Consulting
  • Pricing
  • Blog
  • Login
  • Try LiveCode
Back to
  • slides
  • tutorial
Resources

Documenting the Widget

Topic Progress:
← Back to Lesson

Extensions can provide an API (Dictionary) and User Guide as part of the installed package. They are installed and viewable through the LiveCode Dictionary stack.

In Lesson 2 we documented a library extension, which involved documenting the handlers provided by the library.

To document the widget we will document the properties and messages associated with the widget. As will the Hello World library we will use in-line documentation comments in the LCB file to document the widget.

A description of the widget can be included in a comment block at the top of the LCB file.

This description will appear in the Dictionary stack under the API entry for the widget identifier.

Add a comment block with a description of the widget at the start of the LCB file.

/**
A rotated text control. A rotated text control displays text rotated to a given number of degrees. O degrees being unrotated.
**/
widget community.livecode.elanorb.rotatedText
 ... widget code
end widget

Documenting messages

Widget messages are not declared explicitly in the LCB file so all message shoudle be documented within the comment block that included the widget description at the start of the LCB file.

Each message has

  • Name
  • Type
  • Syntax
  • Description

Add the documentation for the mouseUp message to LCB file.

You can add documentation for multiple messages in this comment block.

/**
A rotated text control. A rotated text control displays text rotated to a given number of degrees. O degrees being unrotated.
 
Name: mouseUp
Type: message
Syntax: on mouseUp

Description:
The <mouseUp> message is sent when the widget is clicked.
**/
widget community.livecode.elanorb.rotatedText
 ... widget code
end widget

Documenting properties

To document properties in LCB the documentation is included above the property definition within a /** **/ comment block.

Include:

  • Syntax: the syntax for using the property. This usually included a set and get example.
  • Summary: a brief description of the property.
  • Description: a more extensive description of the property, its effects and how to use it.

Add in-line documentation for the declared Rotated Text widget properties: rotation, content, formattedWidth and formattedHeight.

/**
Syntax: set the rotation of <widget> to <pDegrees>
Syntax: get the rotation of <widget>

Summary: The number of degrees the text displayed in the widget is rotated by.

Description:
Use the <rotation> property to set the amount the text displayed in the widget is rotated by. The default is 0 degrees which is unrotated, horizontal text. The etxt is rotated in a clockwise direction.
**/
property "rotation" get mRotation set setRotation

The foregroundColor property shadows a LiveCode property and is not declared explicitly in the widget source code the documentation must be in the top-level comment beside the message documentation.

Include:

  • Name: the property name.
  • Type: “property”.
  • Syntax: the syntax for using the property. This usually included a set and get example.
  • Summary: a brief description of the property.
  • Description: a more extensive description of the property, its effects and how to use it.
/**
...widget and message documentation

Name: foregroundColor
Type: property
Syntax: set the foregroundColor of <widget> to <pColor>
Syntax: get the foregroundColor of <widget>
Summary: The text color of the widget
Description:
Use the <foregroundColor> property to control the text color of the widget.
**/
widget community.livecode.elanorb.rotatedText
  … widget code
end widget

Browsing the documentation

Use the Extension Builder to install the widget. You can find the widget icons in the Lesson 4 Resources.

You will see the Rotated Text widget in the Tools Palette.

Open the Dictionary stack and select Rotated Text from the drop down menu.

The documentation for the widget, message and properties will be shown in the Dictionary stack.

dictionary

← Previous Topic

← Previous Topic Next Topic →
  •  
  •  
  • (0)
  •  

Expand All | Collapse All
Lessons Status
1 - Hello World Library
  • Introduction
  • Installing a Text Editor
  • Creating an LCB library
  • LCB library definition
  • LCB handler definitions
  • Compiling and testing a library in LiveCode
  • LCB metadata
  • Installing an LCB Library
  • Packaging and sharing an LCB library
  • Including an LCB library in a standalone
  • Conclusion
2 - Extended Hello World Library
  • Introduction
  • Explicit Types
  • LCB Lists and Arrays
  • Type Conversion between LCB and LiveCode Script
  • Using Explicit Typing in the Library
  • Passing Parameters to the Library
  • Using Lists in the Library
  • Documenting the Library
  • Browsing the Documentation
  • Conclusion
3 - Rotated Text Widget
  • Introduction
  • Defining a Widget
  • LCB Module Level Variables
  • Widget Properties
  • Widget Handlers
  • LCB Canvas Operations
  • Compiling and Testing the Widget
  • Installing the Widget and adding it to a Stack
  • Including the Widget in a Standalone
  • Conclusion
4 - Extended Rotated Text Widget
  • Introduction
  • Integrating Properties
  • Accessing LiveCode Control Properties
  • Handling Mouse Events
  • Saving and Loading Widgets
  • Read Only Properties
  • Documenting the Widget
  • Conclusion
5 - Pie Chart Widget
  • Introduction
  • Planning the Widget
  • Widget Properties
  • The OnCreate Handler
  • The OnPaint Handler
  • Responding to Mouse Events
  • Saving and Loading the Widget
  • Installing and Including the Widget in a Standalone
  • Documenting the Widget
  • Conclusion
6 - Modifying the Line Graph Widget
  • Introduction
  • Duplicating the Line Graph Widget
  • Additional Color Properties
  • Filling the area below the line
  • Adding graph marker mouse events
  • Conclusion
7 - Additional Resources
  • Extending LiveCode Guide
  • LiveCode Builder Language Reference
  • LiveCode Builder Style Guide
  • LiveCode Documentation Format
 

LCB Source

LCB Source
 

Login

LiveCode

  • Why LiveCode?
  • Pricing
  • Customer Stories
  • Extensions
  • LiveCode in Education
  • LiveCode in Business

Looking for LiveCode FileMaker?

LiveCode for FM

Resources

  • Docs
  • API (Language Dictionary)
  • Lessons
  • Sample Stacks
  • Forums
  • Stackoverflow
  • User Groups
  • Support
  • Directory
  • LiveCode Services

About

  • About
  • Meet The Team
  • Careers at LiveCode
  • Contact us

Recent Posts

  • LiveCode Classic 10.0.1 Stable and 10.0.2-rc-1 Released
  • Create Progress – the Three D’s
  • LiveCode Create: Closing out the year with big steps forward
  • Create dp-5: Unified Engines and Shared Extensions
  • 3 Great New LiveCode Releases
Sitemap
Terms Privacy Policy EULA
Brought to you by LiveCode Ltd, Registered in Scotland, No. SC200728
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok