请教关于Tcomboobox的问题 可以把值储存在Items中因为Items是TStrings对象,TStrings对象可以储存一个指针,指向你定义的数据块的地址 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以呀,不过你要继承TCOMBOBOX写一个类如下面 TMYCombo=class(TCombobox) private FItems:TStringList;//保存代码 procedure FillItems; function GetCode(Index:Integer):string; public Property Code[Index:Integer]:string read GetCode write SetCode; end; ...... 再详细一点啊,最好能给源码 :)我刚学delphi,就是感觉这个combobox不如其它的语言方便 如果你的COMBOBOX里面要显示的值是少数确定的几个可以按照BlueTrees(蜗牛) 说的,如果需要存储的值是不确定的,尤其是需要从数据库中取出来的,你可以采用我说的方法,具体将就是自己写一个COMPONENT按装到面板上。TMYCombo=class(TCombobox) private FItems:TStringList;//保存代码 procedure FillItems; function GetCode(Index:Integer):string; public Property Code[Index:Integer]:string read GetCode write SetCode; end;procedure TMyCombo.FillItems;begin Self.Items.Add('按点击数排序'); Self.FItems.Add('Visited'); Self.Items.Add('按最后修改时间排序'); Self.FItems.Add('UPDATETIME');.... end;function TMyCombo.GetCode(Index:Integer):string;begin Result:=FItems.strings[Index];end;执行时,你可以用 CurrCode:=MyCombo.Code[MyCombo.ItemIndex];取得当前显示内容的翻译代码 可以利用combobox.text 和 combobox.itemindex 啊。 不行吗?? 弄来弄去弄不成类这个东西,想出来一个简单的办法----初始化combobox的时候定义一个数组,把value放数组里面挺好用的 一条SQL语句在ACCESS数据库中运行正常,在DELPHI中提示语法错? 今天我弟生日,散分~~~~~~~~~~~~ 录入界面上的项目需要动态设置 Socket的问题 请帮忙编一个范例!谢谢! 关于数据感知组件的感知数据更新问题 自写的使用CDS装载TREE的片段,你有更好的吗 这是delphi5.0中query的一个bug吗? 怎样将DBGrid设置为半透明或透明?求高手帮忙。...... 一个好菜的问题,送分! 在DELPHI5中怎样调用*.chm的帮助文件。在下深表感谢!!! 有关activeform的问题,怎么不能使用数据模块?
TMYCombo=class(TCombobox)
private
FItems:TStringList;//保存代码
procedure FillItems;
function GetCode(Index:Integer):string;
public
Property Code[Index:Integer]:string read GetCode write SetCode;
end;
......
我刚学delphi,就是感觉这个combobox不如其它的语言方便
如果需要存储的值是不确定的,尤其是需要从数据库中取出来的,你可以采用我说的方法,
具体将就是自己写一个COMPONENT按装到面板上。
TMYCombo=class(TCombobox)
private
FItems:TStringList;//保存代码
procedure FillItems;
function GetCode(Index:Integer):string;
public
Property Code[Index:Integer]:string read GetCode write SetCode;
end;procedure TMyCombo.FillItems;
begin
Self.Items.Add('按点击数排序');
Self.FItems.Add('Visited');
Self.Items.Add('按最后修改时间排序');
Self.FItems.Add('UPDATETIME');
....
end;function TMyCombo.GetCode(Index:Integer):string;
begin
Result:=FItems.strings[Index];
end;
执行时,
你可以用
CurrCode:=MyCombo.Code[MyCombo.ItemIndex];
取得当前显示内容的翻译代码
可以利用combobox.text 和 combobox.itemindex 啊。 不行吗??
初始化combobox的时候定义一个数组,把value放数组里面
挺好用的