Phonebot developer's reference/Advanced tools

From EtherWiki
< Phonebot developer's reference
Revision as of 02:33, 27 April 2012 by Sstrader (talk | contribs) (Display properties)
Jump to: navigation, search

Phonebot Plus introduces several tools to Phonebot in order to simplify development and to help create more manageable applications. Applications created in Phonebot Plus will run in Phonebot, but some features can only be edited in Phonebot Plus.

Script debugger

Applications and modules can be executed using the Run menu to call Run, Debug, and "Step into". Run executes the application normally. Debug and "Step into" execute the application in debug mode. Debug mode displays a debug bar with debug buttons, status, and a script viewer.

The News Reader example paused while querying an RSS feed

The debug buttons allow you to stop the application, pause on the next line, step over the current line, and execute the code. The status displays the current object and event, and the debug state. The script viewer displays the current script with the active line highlighted.

Resource management

Script browser

The Script Browser in Phonebot is used to track scoped variable references and delete any unreferenced variables from an application. The advanced browser in Phonebot Plus adds access to all scripts within an application and management of user-defined methods.

The Script Browser for the Notepad application

The Script Browser lists the application object and every module object. Within each object line item are sections labeled Variables and Scripts. From here, scripts within every event and method can be edited without having to navigate to the specific object's properties.

Database browser

The Database browser can be used to create and manage both the schema and data for application databases.

Log browser

The Log browser opens the Logging view (also accessible from the application list view) with logs filtered to the current application.

User-defined methods

User-defined methods are blocks of script not tied to any object event. Like scoped variables, user-defined methods can be attached to the application object or a module object. User-defined methods are useful for scripts that may be called in multiple instances. For example, an application could load a list within module.on_open or within a button.on_click when a refresh is required. The same code could be contained in a user-defined method and called from each event. This avoids duplicating the code in both places.

Methods are created from the Script browser by long clicking on the application or module line item. Once created, methods will show up in the Script browser's scripts along with any application or module events. They will also be listed in the Method builder when creating scripts.

Display properties

Modules, controls, and groups have a Display property in Phonebot Plus that controls background color, padding, font, and image properties.

The Display property dialog

Image properties are available for the image control which can display an image either from a URL or from the local file system.

The image can be stored in the following ways:

Name Value Description
Link link Always display the image located at the URL or directory.
Link with copy link_copy Display the linked image and store a local copy If the image is no longer available, the copy will be displayed.
Copy copy Always use a local copy.

The image can be scaled with the following methods:

Name Value Description
Center center Center the image in the view, but perform no scaling.
Center crop center_crop Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding).
Center inside center_inside Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).
Fit center fit_center Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. The result is centered inside dst.
Fit end fit_end Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. END aligns the result to the right and bottom edges of dst.
Fit start fit_start Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. START aligns the result to the left and top edges of dst.
Fit XY fit_xy Scale in X and Y independently, so that src matches dst exactly. This may change the aspect ratio of the src.

--ImageView.ScaleType

--Matrix.ScaleToFit