使用 IntraWeb (19) - 基本控件之 TIWTreeView
这是个饱受非议的控件; 我通过尝试, 理解了非议, 也能理解作者. 总之向作者的思路靠拢吧, 还是不错的.
TIWTreeView 所在单元及继承链:
IWCompTreeview.TIWTreeView
主要成员:
property Items: TIWTreeViewItems //所有 Item 的集合
property Selected: TIWTreeViewItem //在这里, 叫做 "当前 Item" 更合适
property AutoIndent: Boolean //是否自动缩排; 默认 True
property DoServerSidePlusMinus: Boolean //如果是 True, Html 中不包含被折叠的部分, 需要展开时再从服务器读取; 相反, Html 中包含所有节点; 默认 False
property TreeViewImages: TIWTreeViewImages //通过其 OpenFolderImage、ClosedFolderImage、DocumentImage、PlusImage、MinusImage 子属性指定五个图标
property ItemSpace: TIWTreeViewItemSpace //调整纵、横间距
property UseItemImages: Boolean //是否使用 Item 标志图像
property TreeViewImagesWidth: Integer //图标宽度
property TreeViewImagesHeigth: Integer //图标高度
property UseFrame: Boolean //是否使用框架
property ScrollToName: string //滚动到指定名称的 Item
property ScrollBars: TIWScrollStyle //滚动条选项
property WrapItems: Boolean //Item 文本能否换行; 默认 False
property DoRefreshControl: Boolean //在修改某些属性时必须让它为 True 才会有效 property TreeItemClick: TIWTreeViewClickEvent //通过它可以为每个 Item 指定 Click 事件
property OnPlusMinus: TTreeViewPlusMinusProc //每当展开或收拢子节点时 procedure ClearAll //
TIWTreeViewItems 与 TIWTreeViewItem:
{IWCompTreeview.TIWTreeViewItems
测试:
{在空白窗体上放 IWRegion1 和 IWTreeView1; 下面代码在设计时实现会更方便}
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
var
fItem: TIWTreeViewItem;
begin
IWRegion1.Width := 200;
IWRegion1.Align := alLeft;
IWRegion1.Color := clWebYellow;
LinkColor := clWebRed; //如果给 TIWTreeViewItem 指定了 OnClick 事件, 它会被呈现为链接
IWTreeView1.Parent := IWRegion1;
IWTreeView1.Align := alClient;
IWTreeView1.Items.Add(nil).Caption := 'ItemA';
IWTreeView1.Items.Add(nil).Caption := 'ItemB';
IWTreeView1.Items.Add(nil).Caption := 'ItemC';
fItem := IWTreeView1.Items.Add(nil);
fItem.Caption := 'ItemD';
IWTreeView1.Items.Add(fItem).Caption := 'ItemD1';
IWTreeView1.Items.Add(fItem).Caption := 'ItemD2';
fItem := IWTreeView1.Items.Add(fItem);
fItem.Caption := 'ItemD3';
IWTreeView1.Items.Add(fItem).Caption := 'ItemD31';
IWTreeView1.Items.Add(fItem).Caption := 'ItemD32';
end;
{尽管可以为每个 Item 指定 OnClick, 但我觉得用 TreeItemClick 事件一起指定更方便; 事件中可以通过其 Tag、ID、Name、Caption等来区别}
procedure TIWForm1.IWTreeView1TreeItemClick(Sender: TObject; ATreeViewItem: TIWTreeViewItem);
begin
if not ATreeViewItem.HasChild then
WebApplication.ShowMessage(ATreeViewItem.Caption);
end;
效果图:

使用 IntraWeb (19) - 基本控件之 TIWTreeView的更多相关文章
- 使用 IntraWeb (24) - 基本控件之 TIWFileUploader、TIWFile
TIWFileUploader 是基于 Ajax 的上传控件, 最初是 Andrew Valums 开发, 从 IntraWeb XIV 纳入并替换 TIWFile. 虽然从组件面板上还能看到 TIW ...
- 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent
TIWAutherList //通过一组户名与密码验证登陆 TIWAutherINI //通过记录户名与密码信息的 #Auth.ini 文件验证登陆 TIWAutherEvent //通过其 OnCh ...
- 使用 IntraWeb (28) - 基本控件之 TIWTemplateProcessorHTML、TIWLayoutMgrHTML、TIWLayoutMgrForm
TIWTemplateProcessorHTML //使用外部的 html 文件做模板 TIWLayoutMgrHTML //直接输入 Html 文本做模板 TIWLayoutMgrForm //这应 ...
- 使用 IntraWeb (26) - 基本控件之 TIWMenu
TIWMenu 的任务是让原来的 TMainMenu 呈现在网页上, 通过其 AttachedMenu 属性关联一个 TMainMenu 是必需的. TIWMenu 所在单元及继承链: IWCompM ...
- 使用 IntraWeb (25) - 基本控件之 TIWRegion
这应该是 IW 中最重要的容器了, 和它同父的还有 TIWTabControl TIWRegion 所在单元及继承链: IWRegion.TIWRegion 主要成员: property Align: ...
- 使用 IntraWeb (23) - 基本控件之 TIWTimer、TIWProgressBar、TIWProgressIndicator、TIWTimeEdit
TIWTimer //和 TTimer 没多大区别, 它的默认事件现在是异步的(OnAsyncTimer), 在网络上使用 OnTimer 肯定是非常糟糕的 TIWProgressBar //进度条 ...
- 使用 IntraWeb (22) - 基本控件之 TIWCalendar
TIWCalendar: 日历控件, 继承于 TIWCustomGrid, 所以它和 TIWGrid 共同属性特多. 它的 Cell 是 TIWCalendarCell 对象, 直接从 TIWGrid ...
- 使用 IntraWeb (20) - 基本控件之 TIWGrid
TIWGrid 最终通过 Html Table 呈现; 其每个 Cell 都是一个 TIWGridCell 对象, Cell 对象的 Control 属性非常好, 可以非常方便地嵌入其他控件. TIW ...
- 使用 IntraWeb (16) - 基本控件之 TIWList、TIWListbox、TIWComboBox、TIWOrderedListbox
TIWList //列表; 它对应 Html 中的 OL.LI(某些选项下会用表格模拟); TIWListbox 和 TIWComboBox 则对应 Html 在的 Option TIWListbox ...
随机推荐
- html5 canvas画布上合成
source-over 默认.在目标图像上显示源图像. source-atop 在目标图像顶部显示源图像.源图像位于目标图像之外的部分是不可见的. source-in 在目标图像中显示源图像.只有目标 ...
- Xcode多种Build Configuration配置使用
Build Configuration? Xcode默认会有2个编译模式,一个是Debug,一个是Release.Release下不能调试程序,编译时有做编译优化,会比用Debug打包出来的运行快,另 ...
- Ajax和jsonp区别
大多数情况下,无论是框架还是自己实现都是通过Ajax的方式来向后端请求数据的,而Ajax之间是通过传输json格式的文件来进行数据的传输的,大家对Ajax也很熟悉了,那么为什么我又要使用jsonp呢? ...
- HDU 1241 Oil Deposits DFS搜索题
题目大意:给你一个m*n的矩阵,里面有两种符号,一种是 @ 表示这个位置有油田,另一种是 * 表示这个位置没有油田,现在规定相邻的任意块油田只算一块油田,这里的相邻包括上下左右以及斜的的四个方向相邻的 ...
- HDU 2680 Choose the best route 最短路问题
题目描述:Kiki想去他的一个朋友家,他的朋友家包括所有的公交站点一共有n 个,一共有m条线路,线路都是单向的,然后Kiki可以在他附近的几个公交站乘车,求最短的路径长度是多少. 解题报告:这道题的特 ...
- nested exception is com.svorx.core.dao.PersistenceException
在quartz定时执行任务的时候,hibernate报错,在只读事务中进行了update语句: [ERROR] 2018/08/03 10:35:00,827 org.quartz.core.JobR ...
- linux笔记_day11_shell编程
1.条件测试类型: 整数测试 字符测试 文件测试 条件测试的表达式: [ expression ] 必须有空格 [[ expression ]] test expression 整数比较 : -eq ...
- MySQL用户密码过期登陆报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
今天接到主从复制失败告警,查看MySQL,发现MySQL能够登陆但是执行命令报错, ERROR 1820 (HY000): You must reset your password using ALT ...
- sass和scss相关知识
参考地址:http://www.imooc.com/learn/311 什么是css预处理器? CSS 预处理器定义了一种新的语言,其基本思想是,用一种专门的编程语言,为 CSS 增加了一些编程的特性 ...
- 当父级绑定了DataContext之内的数据源时,子级想重新绑回DataContext
<Grid x:Name="NewDeploymentObjectPanel" Background="White" DataContext=" ...