可以把值储存在Items中因为Items是TStrings对象,TStrings对象可以储存一个指针,指向你定义的数据块的地址

解决方案 »

  1.   

    可以呀,不过你要继承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;
       ......
      

  2.   

    再详细一点啊,最好能给源码 :)
    我刚学delphi,就是感觉这个combobox不如其它的语言方便
      

  3.   

    如果你的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];
    取得当前显示内容的翻译代码
      

  4.   


      可以利用combobox.text 和 combobox.itemindex 啊。 不行吗??
      

  5.   

    弄来弄去弄不成类这个东西,想出来一个简单的办法----
    初始化combobox的时候定义一个数组,把value放数组里面
    挺好用的