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的更多相关文章

  1. .Net 中的反射(序章) - Part.1

    引言 反射是.Net提供给我们的一件强力武器,尽管大多数情况下我们不常用到反射,尽管我们可能也不需要精通它,但对反射的使用作以初步了解在日后的开发中或许会有所帮助. 反射是一个庞大的话题,牵扯到的知识 ...

  2. 从零开始学ios开发(五):IOS控件(2),Slider

    下面继续学习ios的其他控件,这次会使用到的控件有Slider,当然还有一些之前已经使用过的控件Label. 这次我们不新建一个project了,当然如果你愿意重新创建一个新的项目也完全可以,我们还是 ...

  3. 02-UIKit控件、MVC

    目录: 一.控件使用 二.动态类型和静态类型 三.MVC 四.UIAlertView对话框 回到顶部 一.控件使用 1 事件源,事件处理方法有一个参数传进来,那个参数就是触发这个事件的时间源. UIS ...

  4. NET控件Designer架构设计

    总体结构 Designer总体上由三大部分组成:View,ViewModel和Model,这个结构借鉴了流行的MVVM模式.这三部分的职责分工是: View 负责把ViewModel以图形的方式展现出 ...

  5. Solidity的三种合约间的调用方式 call、delegatecall 和 callcode

    0x00 前言 Solidity(http://solidity.readthedocs.io/en/v0.4.24/) 是一种用与编写以太坊智能合约的高级语言,语法类似于 JavaScript. S ...

  6. c# 共享事件处理程序

    使用同一个方法来处理多个Button实例的Click事件. 1.全选所有的Button,在事件添加中的Click点击事件中添加处理函数. 2.假如一个label控件用于显示按钮按下输出文本 3.处理函 ...

  7. WP8.1学习系列(第十九章)——事件和路由事件概述

    我们将介绍在使用 C#.Visual Basic 或 Visual C++ 组件扩展 (C++/CX) 作为编程语言并使用 XAML 进行 UI 定义时,针对 Windows 运行时应用的事件的编程概 ...

  8. tab键、快捷键、默认按钮、小数点输入的使用--四则运算

    1. 窗体Tab键的顺序设置 选中窗体-视图-tab键顺序 label不适用tab键 2. 热键设置和快捷键设置 热键:无论光标在哪都可以 快捷键:出现界面后才能按 添加label 更改label的T ...

  9. DataTable 转换成 Json的3种方法

    在web开发中,我们可能会有这样的需求,为了便于前台的JS的处理,我们需要将查询出的数据源格式比如:List<T>.DataTable转换为Json格式.特别在使用Extjs框架的时候,A ...

随机推荐

  1. ES6必知必会 (四)—— Symbol、Set和Map

    Symbol 1.Symbol 是 ES6 引入了一种新的原始数据类型,表示独一无二的值.它是 JavaScript 语言的第七种数据类型,前六种分别是:undefined.null.布尔值(Bool ...

  2. Documentation/usb/gadget_configfs.txt

    Linux USB gadget configured through configfs 25th April 2013 Overview======== A USB Linux Gadget is ...

  3. SQL Server 中关于EXCEPT和INTERSECT的用法

    熟练使用SQL Server中的各种用法会给查询带来很多方便.今天就介绍一下EXCEPT和INTERSECT.注意此语法仅在SQL Server 2005及以上版本支持. EXCEPT是指在第一个集合 ...

  4. Javascript 在严格模式下禁止指向 this

    如下代码, f() 输出的是 false,而 f2() 输出的是 true. 这是因为 f2 在严格模式下禁止 this 指向全局,所以 this 是 undefined, !this 当然是 tru ...

  5. python 网络编程要点

    From http://www.zhihu.com/question/19854853 Python网络编程是一个很大的范畴,个人感觉需要掌握的点有:1. 如何使用Python来创建socket, 如 ...

  6. centos6安装GitLab全程详解和常见问题解决

    GitLab,是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用. 官方只提供了Debian/Ubuntu系统下的安 ...

  7. 使用Jquery实现Win8开始菜单效果的站点导航

    前言: 本人是个Metro控,自我感觉到处都充斥着Metro的元素,个人认为这种风格强调表现以及内容,以简洁著称,不过也不是大部分都喜欢,也有一些人和你讨厌这种风格~不过本人非常喜欢这种风格,看我博客 ...

  8. java工具类-FreeMarker

    package com.huawei.it.citools.utils; import java.io.File;import java.io.IOException;import java.io.S ...

  9. C++ namespace命名空间

    1.什么是命名空间 简而言之:划片取名 加入有两个公司,公司A里面有一个员工小明,公司B里面有一个员工小明,两个公司在同一栋楼.这时,你去找小明,你再楼下大喊:“小明!你给我下来!”,这时两个小明都会 ...

  10. R语言学习——输入与输出

    导入数据: grades<-read.table("D:/ProgramData/test1.txt",sep="\t") 求均值:mean() 求方差: ...