您的位置:首页 > 其它

smartclient框架组件介绍5(Img,Label,IButton,ToolStrip)

2012-08-21 11:17 337 查看
Img:图标组件
一个可以用来显示图片的组件

效果图



组件属性、方法清单

属性
名称/描述
imageHeight : Integer
图片的高度
imageWidth : Integer
图片的宽度
imageType : ImageStyle
设置图片的类型,缺省类型是stretch
name : String
设置组件在html中的name属性
showTitle : Boolean
是否显示标题
size : Number
设置图片的高和宽为指定的值
src : SCImgURL
设置图片的url
usePNGFix : Boolean
设置是否需要在IE浏览器中进行对png图片修正
方法
名称/描述
resetSrc
重新加载图片
void resetSrc ()
setImageType
设置图片的类型
void setImageType (imageType:ImageStyle )
setSrc
设置图片的url
void setSrc (URL)

Label:

一个可以用来显示图片加文字的组件

效果图



组件属性、方法清单

属性
名称/描述
Align: Alignment
文本显示的位置,缺省值为“left”
autoFit : Boolean
是否需要根据内容自动调整组件大小
icon : SCImgURL
指定图片的url
iconAlign : String
指定图片显示的位置,可以是“right”或“left”
iconHeight : Integer
设置图片的高度,缺省为图片的原始高度
iconSize : Integer
设置图片的高和宽
iconSpacing : Integer
设置图片的四周的填充宽度
iconWidth : Integer
这边图片的宽度
wrap : Boolean
当文本显示不小的时候,是否需要自动换行
方法
名称/描述
setContents
设置需要显示的文本内容
void setContents (newContents:String)
setIcon
设置需要显示的图片的url
void setIcon (icon:Url)

IButton:按钮

效果图



组件属性、方法清单

属性
名称/描述
actionType : SelectionType
按钮的类型,可以是“button”, “radid”, “checkbox”

align : Alignment
指定按钮标题的位置,缺省为“center”
capSize : Number
How big are the end pieces by default
hiliteAccessKey : Boolean
如果标题中包括有快捷键盘,是否需要给快捷键加下划线
icon : SCImgURL
设置图片的url。
iconAlign : String
设置图片的位置。
iconHeight : Integer
设置图片的高。
iconSize : Integer
设置图片的宽和高
iconSpacing : Integer
设置图片四周的填充宽度
iconWidth : Integer
设置图片的宽
radioGroup : String
分组标示
selected : Boolean
是否选中
showDisabled : Boolean
在组件不可用的时候是否需要显示状态的改变
showDisabledIcon : Boolean
当按钮不可用的时候,是否需要显示不可以用的图片
showDown : Boolean
当按钮不点击的时候,是否需要显示被按下去的状态
showDownIcon : Boolean
If using an icon for this button, whether to switch the icon image when the mouse goes down on the button.
showFocus : Boolean
Should we visibly change state when the canvas receives focus? Note that by default the over state is used to indicate focus.
showFocused : Boolean
Should we visibly change state when the canvas receives focus?
showFocusedIcon : Boolean
If using an icon for this button, whether to switch the icon image when the button receives focus.
showRollOver: Boolean
Should we visibly change state when the mouse goes over this object?
showRollOverIcon : Boolean
If using an icon for this button, whether to switch the icon image on mouse rollover.
showSelectedIcon : Boolean
If using an icon for this button, whether to switch the icon image when the button becomes selected.
showTitle : Boolean
Determines whether any specified title will be displayed for this component.
src : SCImgURL
Base URL for the image. By default, StretchImgButtons consist of three image parts: A start image (displayed at the top or left), a scalable central image and an end image
displayed at the bottom or right.
state : State
Current "state" of this widget. StatefulCanvases will have a different appearance based on their current state.
title : String
The text title to display in this button.
titleStyle : CSSStyleName
CSS style applied to the title text only. Defaults to StretchImgButton.baseStyle when unset.
valign : VerticalAlignment
Vertical alignment of this component's title.
vertical : Boolean
Default is a horizontal button. Vertical StretchImgButtons are allowed, but title text, if any, will not be automatically rotated.
wrap : Boolean
Should the title for this button wrap? If unset, default behavior is to allow wrapping if this.vertical is true, otherwise disallow wrapping
方法
名称/描述
action
触发按钮点击事件
void action ()
addToRadioGroup
指定按钮的分组id
void addToRadioGroup (groupID:String)
deselect
去选中
void deselect ()
getActionType
获取按钮类型
void getActionType ()
getState
获取按钮状态
State getState ()
getTitle
获取按钮标题
String getTitle ()
iconClick
按钮图标是否支持点击
Boolean iconClick ()
isSelected
按钮是否选中
Boolean isSelected ()
removeFromRadioGroup
移除分组
void removeFromRadioGroup ([groupID:String])
select
选中按钮
void select ()
setActionType
设置按钮类型
void setActionType ()
setDisabled
设置按钮的使能状态
void setDisabled (disabled:Boolean)
setIcon
设置按钮图标
void setIcon (icon:url)
setTitle
设置按钮标题
void setTitle (newTitle)

create方法

详述

方法名
Create
概述
通过输入设置的各个属性创建对应的按钮
返回
菜单
参数(可以是菜单组件的任意一个属性)
参数
说明
width:N
设置按钮宽度
disabled:Boolean
是否灰化
action:function
按钮动作响应
title:String
按钮标题

使用示例

isc.IButton.create(

{

width: 75,

autoDraw : true,

disabled:false,

action:function(){

//do action

},

title: "abc",

});

ToolStrip:工具栏

ToolStrip是一个工具条容器,可以将各种按钮放到这个容器上构成一个工具条



效果图

组件属性、方法清单

属性
名称/描述
formWrapper :AutoChild
DynamicForm instance created by ToolStrip.addFormItem() to contain form items for display in this toolStrip. Each time addFormItem()
is run, a new formWrapper autoChild will be created, picking up properties according to the standard AutoChild pattern.
formWrapperConstructor
:String:
SmartClient class for generated ToolStrip.formWrapper components.
formWrapperDefaults
:Object
Default properties to apply to ToolStrip.formWrapper components.
formWrapperProperties :Object
Properties to apply to ToolStrip.formWrapper components.
height :Number
ToolStrips set a default height to avoid being stretched by containing layouts.
members
:Array[Canvas]
Array of components that will be contained within this Toolstrip
separatorSize :Integer
Separator thickness in pixels
vertical :Boolean
Indicates whether the components are drawn horizontally from left to right (false), or vertically from top to bottom (true).
方法
名称/描述
addFormItem
添加一个表单到组件上
DynamicForm addFormItem (formItem: FormItem [, formProperties:Object, position:Number])
addMember
添加一个成员到组件上
void addMember (newMember:Canvas[, position:Number])

addMember方法

详述

方法名
addMember
概述
添加一个组件

返回

参数
参数
说明
newMember :Canvas
被添加的组件对象
position :Number (可选)
新组件的的位置

使用示例

var btn= isc.IButton.create(

{

width: 75,

autoDraw : true,

disabled:false,

action:function(){

//do action

},

title: "abc",

});
var toolStrip = isc.ToolStrip.create(
{

membersMargin : 5,
width : "100%",
height : "100%"
});
toolStrip.addMember(btn); //向工具条上添加一个按钮
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: