TIWTabControl 包含的是 TIWTabPage; 设计时通过右键菜单 Add Page 添加(再给页面添加东西时一定要先选定页面); 下面例子是动态添加的.


TIWTabControl 所在单元及继承链:
IWCompTabControl.TIWTabControl

主要成员:


property Pages: TList //TIWTabPage 对象的集合; 但它是 TList 类型, 使用前需转换下
property ActiveTabFont: TIWFont //当前 Tab 标签的字体
property ActiveTabColor: TIWColor //当前 Tab 标签的背景色
property InactiveTabFont: TIWFont //其他 Tab 标签的字体
property InactiveTabColor: TIWColor //其他 Tab 标签的背景色
property ActivePage: Integer //当前页号; 如果需要设置它将导致提交, 官方给出了通过 js 进行本地设置的方法: IWTABCONTROL1.tabPane.setSelectedIndex(i);
property BorderOptions: TIWContainerBorderOptions //它的边框选项还是比较复杂的, 个人觉得: 如果需要边框还不如套个 TIWRegion
property LayoutMgr: TIWContainerLayout //布局管理器, 它也可以用模板(它是从 TIWCustomRegion 继承的)
property Color: TIWColor // property OnChange: TNotifyEvent //
property OnAsyncChange: TIWAsyncEvent // procedure Submit(const AValue: string) //
procedure pageAdded(APage: TIWTabPage) //
procedure pageRemoved(APage: TIWTabPage) //
function CreateNewPage(const APageTitle: string; const APageName: string): TIWTabPage //

TIWTabPage:


{IWCompTabControl.TIWTabPage

测试:

{先在空白窗体上放 1 个 TIWTabControl, 3 个 TIWTabPage, 2 个 TIWButton}
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
var
fPage1, fPage2, fPage3: TIWTabPage;
begin
//动态建立 3 个 TIWTabPage
fPage1 := IWTabControl1.CreateNewPage(' Page1 ');
fPage2 := IWTabControl1.CreateNewPage(' Page2 ');
fPage3 := IWTabControl1.CreateNewPage(' Page3 '); //让 IWButton1 具备切换标签的功能
JavaScript.Add('var i = 0;'); //js 全局变量
IWButton1.ScriptEvents.HookEvent('onclick', 'i++; i%=3; IWTABCONTROL1.tabPane.setSelectedIndex(i);'); //IWTABCONTROL1 或换成 IWTABCONTROL1IWCL IWTabControl1.Color := $efefef;
IWTabControl1.InactiveTabColor := $efefef;
IWTabControl1.ActiveTabColor := $0000ff; IWGrid1.Parent := fPage1;
IWGrid2.Parent := fPage2;
IWGrid3.Parent := fPage3; IWGrid1.RowCount := 3;
IWGrid1.ColumnCount := 4;
IWGrid1.BGColor := $ffeeee;
IWGrid1.CellPadding :=4;
IWGrid1.Align := alTop; IWGrid2.RowCount := 4;
IWGrid2.ColumnCount := 5;
IWGrid2.BGColor := $eeeeff;
IWGrid2.CellPadding := 4;
IWGrid2.Align := alTop; IWGrid3.RowCount := 5;
IWGrid3.ColumnCount := 6;
IWGrid3.BGColor := $eeffee;
IWGrid3.CellPadding := 4;
IWGrid3.Align := alTop;
end; {测试 Pages 属性}
procedure TIWForm1.IWButton2Click(Sender: TObject);
begin
WebApplication.ShowMessage(TIWTabPage(IWTabControl1.Pages[0]).Title); // Page1
end;

效果图:


最新文章

  1. Elasticsearch5.1.1+ik分词器+HEAD插件安装小记
  2. ios 向工程里添加Fonts
  3. 建立MySQL的ODBC
  4. http://blog.sina.com.cn/s/blog_5bd6b4510101585x.html
  5. swfit 中的类型属性说明
  6. Right Column - 右侧栏目
  7. C参数计算
  8. Codeforces Round #Pi (Div. 2) ABCDEF已更新
  9. ASP.NET的WebConfig
  10. iscroll.js & flipsnap.js
  11. [HNOI 2018]游戏
  12. 《ASP.NET Core In Action》读书笔记系列,这是一个手把手的从零开始的教学系列目录
  13. golang 实现文件传输小demo
  14. android 一步一步教你集成tinker(热修复)
  15. Python API快餐教程(1) - 字符串查找API
  16. Spring cron 定时调度配置
  17. const 指针
  18. Struts2 的ActionContext 详解
  19. laravel5.4中{{$name}} 和 {{!! $name !!}} 的区别:后者原生输出。前者转义
  20. 我们一起学习WCF 第七篇会话模式

热门文章

  1. 阿里云Linux服务器安装 nginx+mysql+php
  2. Passbook
  3. MongoDB 之 Array Object 的特殊操作 MongoDB - 6
  4. 求矩形的周长(线段树+扫描线) Picture POJ - 1177
  5. Shell命令行中特殊字符与其转义详解(去除特殊含义)
  6. 『实践』Yalmip+Ipopt+Cplex使用手册
  7. APP的CPU,内存,耗电,流量测试工具
  8. mysql子查询 exists,not exists,all和any
  9. Demo005 小学四则运算自动生成程序
  10. java Comparator和Comparable(比较器)