Container: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
 
[[File:Container.png|frameless|left|Containers: A header, a simple DIV, a wrapper and a button.]]
[[File:Containeraddchild.png|frameless|left|Adding a control to a container wrapper.]]


== Description ==
== Description ==

Revision as of 12:45, 31 March 2015

Containers: A header, a simple DIV, a wrapper and a button.
Containers: A header, a simple DIV, a wrapper and a button.
Adding a control to a container wrapper.
Adding a control to a container wrapper.

Description

The Container control is an HTML wrapper which you can use to create your own control or element. It was introduced in AppStudio 5, and replaces and enhances the Generic control.

It can be used to create customized HTML element by setting the HTMLTag property to <div> or the name of almost any other HTML element. The content property is the innerHTML of the element. It can be simple text or a complex HTML structure.

The Container control can also be used as a wrapper for other controls you have set up in your project. Add them to the Design Screen as usual, then right click in a Container and use Add Child. The control will then move into the Container. If you reposition the Container, the included controls ("children") will move with it. Use right click Remove Child to take a child out of a Container.

The positioning of controls in a Container defaults to 'relative'. When a control is added to a Container, its left and top properties are set to 'initial', and 'Float:left;' is added to the Style property. The result is that children in a Container act as Responsive Design elements: element flow and reflow is based on the screen size. If property is set to 'absolute', the top and left properties explicitly set the position of the children.

All the usual events are supported.

To add a Container control to your app, choose the Container icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need. Right click in the Container to add children.

Properties

Standard properties are supported, plus:

attributes A list of HTML attributes. To prevent jQuery Mobile from styling the element, use data-role=none. Attributes are separated by spaces. Design time.
class List of CSS classes to apply to the element. Class names are separated by spaces. Design time.
content The text to use in between the HTML tags. Can be text or HTML. Design time.
HTMLTag The HTML tag of the control. Common values are div, button, text, ol, etc. For example. if value is 'button', then this HTML will be created: <button>content</button>. Design time.
position How children positioned. Default is 'relative': elements are positioned relative to each other and the size of the Container. With 'absolute', controls are positioned within the Container set by width and height. Other options are 'fixed' and 'static'. Design time.
style A list of style properties, each in the form styleName:value; Example: "height:40px; width:100px".Design time.

Events

Standard events are supported.

Examples

Change the color of the text

Container1.style.color = "red"