Sender 转换TButtonItem TCategoryButtons
http://codeverge.com/embarcadero.cppbuilder.using/using-sender-to-determine-which/1068317
http://qc.embarcadero.com/wc/qcmain.aspx?d=70595
Using *Sender to determine which button triggered even
Sender 转换到TButtonItem
不能
TButtonItem *bi = static_cast<TButtonItem*>(Sender);
改用下面的方式
TCategoryPanel *CategoryPanel;
for (int i = ; i < TreeView1->Items->Count; i++)
{
if (TreeView1->Items->Item[i]->Level == )
{
CategoryPanel = new TCategoryPanel(CategoryPanelGroup1);
CategoryPanel->PanelGroup = CategoryPanelGroup1;
CategoryPanel->Caption = TreeView1->Items->Item[i]->Text;
}
TCategoryButtons * CategoryButtons;
CategoryButtons = new TCategoryButtons(CategoryPanel);
CategoryButtons->Parent = CategoryPanel;
CategoryButtons->Align = alTop;
CategoryButtons->Height = TreeView1->Items->Item[i]->Count * (this->Canvas->TextHeight("a") + );
CategoryButtons->ButtonOptions << boFullSize;
CategoryPanel->Height = CategoryButtons->Height + ;
TButtonCategory *ButtonCategory;
ButtonCategory = new TButtonCategory(CategoryButtons->Categories);
TButtonItem *bi;
// CategoryButtons->Categories->Items[0]->Items //TButtonCollection*
if (TreeView1->Items->Item[i]->HasChildren)
{
for (int j = ; j < TreeView1->Items->Item[i]->Count; j++)
{
bi = new TButtonItem(CategoryButtons->Categories->Items[]->Items);
bi->Caption = TreeView1->Items->Item[i]->Item[j]->Text;
}
}
}
CategoryPanelGroup1->CollapseAll();
void __fastcall TForm28::CategoryButtons1Categories0Items0Click(TObject *Sender)
{
TCategoryButtons *cb = static_cast<TCategoryButtons*>(Sender);
TButtonItem *bi = static_cast<TButtonItem*>(cb->SelectedItem);
Caption = bi->Caption;
}
CategoryButtons.BorderStyle=bsNone
CategoryButtons.ButtonHeight=40
CategoryButtons.ButtonWidth=100
Sender 转换TButtonItem TCategoryButtons的更多相关文章
- .Net 中的反射(序章) - Part.1
引言 反射是.Net提供给我们的一件强力武器,尽管大多数情况下我们不常用到反射,尽管我们可能也不需要精通它,但对反射的使用作以初步了解在日后的开发中或许会有所帮助. 反射是一个庞大的话题,牵扯到的知识 ...
- 从零开始学ios开发(五):IOS控件(2),Slider
下面继续学习ios的其他控件,这次会使用到的控件有Slider,当然还有一些之前已经使用过的控件Label. 这次我们不新建一个project了,当然如果你愿意重新创建一个新的项目也完全可以,我们还是 ...
- 02-UIKit控件、MVC
目录: 一.控件使用 二.动态类型和静态类型 三.MVC 四.UIAlertView对话框 回到顶部 一.控件使用 1 事件源,事件处理方法有一个参数传进来,那个参数就是触发这个事件的时间源. UIS ...
- NET控件Designer架构设计
总体结构 Designer总体上由三大部分组成:View,ViewModel和Model,这个结构借鉴了流行的MVVM模式.这三部分的职责分工是: View 负责把ViewModel以图形的方式展现出 ...
- Solidity的三种合约间的调用方式 call、delegatecall 和 callcode
0x00 前言 Solidity(http://solidity.readthedocs.io/en/v0.4.24/) 是一种用与编写以太坊智能合约的高级语言,语法类似于 JavaScript. S ...
- c# 共享事件处理程序
使用同一个方法来处理多个Button实例的Click事件. 1.全选所有的Button,在事件添加中的Click点击事件中添加处理函数. 2.假如一个label控件用于显示按钮按下输出文本 3.处理函 ...
- WP8.1学习系列(第十九章)——事件和路由事件概述
我们将介绍在使用 C#.Visual Basic 或 Visual C++ 组件扩展 (C++/CX) 作为编程语言并使用 XAML 进行 UI 定义时,针对 Windows 运行时应用的事件的编程概 ...
- tab键、快捷键、默认按钮、小数点输入的使用--四则运算
1. 窗体Tab键的顺序设置 选中窗体-视图-tab键顺序 label不适用tab键 2. 热键设置和快捷键设置 热键:无论光标在哪都可以 快捷键:出现界面后才能按 添加label 更改label的T ...
- DataTable 转换成 Json的3种方法
在web开发中,我们可能会有这样的需求,为了便于前台的JS的处理,我们需要将查询出的数据源格式比如:List<T>.DataTable转换为Json格式.特别在使用Extjs框架的时候,A ...
随机推荐
- setTimeout设置为0的作用
调用方式:iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])功能:Evaluates an expression afte ...
- Thrift 个人实战--Thrift 网络服务模型(转)
前言: Thrift作为Facebook开源的RPC框架, 通过IDL中间语言, 并借助代码生成引擎生成各种主流语言的rpc框架服务端/客户端代码. 不过Thrift的实现, 简单使用离实际生产环境还 ...
- goss docker-compose 集成使用
原理很简单,就是使用volume 进行数据共享, 并执行服务器状态校验 docker-compose 文件 version: "3" services: goss: image: ...
- 02.将uboot,kernel,rootfs下载到开发板上
转载,侵删 将uboot,kernel,rootfs下载到开发板上 1.为什么要下载 所谓下载,也称烧录,部署. 1.1.什么是u-boot Hi3518EV200 单板的 Bootloader 采用 ...
- Angular 4 绑定
一.事件绑定 1. 创建doOnClick函数 2. 网页中绑定doOnClick方法 3. 效果图 二. 属性绑定 1. 定义imgUrl的网址 2. 定义img src属性 另外一种写法 3. ...
- Dynamics CRM 2011 报表无法显示的问题总结
一.一般打开报表会出现:该报表无法显示.(reProcessingAborted)和由于运行Microsoft SQL Server Reporting Services 的服务器上没有安装 Micr ...
- Python——递归、二分查找算法
递归函数 1. 递归 (1)什么是递归:在函数中调用自身函数(2)最大递归深度:默认997/998——是Python从内存角度出发做的限制 n = 0 def story(): global n n+ ...
- 常见企业IT支撑【6、跳板机Jumpserver】
Jumpserver是国内一款开源的轻便的跳板机系统,他们的官网:http://www.jumpserver.org/ 使用这款软件意在提高公司内部登录生产环境服务器的便捷性,权限分配细化,以及后台管 ...
- 使用postman模拟appium的http请求
Appium是Server,接收http请求,使用Postman模拟请求 1.anyproxy 1.1.安装和运行 #安装 npm i -g anyproxy # 运行anyproxy,端口默认800 ...
- shell 10流程控制
if 判断 if #shell #!/bin/sh a=5 if [[ $a > 3 ]];then echo "$a>3" fi #写成一行 if [[ $a < ...