zoukankan      html  css  js  c++  java
  • DELPHI关于ValueListEditor控件

    DELPHI--关于ValueListEditor控件
    (2011-02-22 17:56:30)
    转载▼
    标签:
    it
        分类: 工作—编程
     
    1.请问在ValueListEditor里,如何知道我选择了哪一行吗??
     答:用procedure TControlPanel.ParamEditorSelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);事件
     注:ParamEditor是我用组件的名字
     
    2.ValueListEditor,他竟然没有Clear方法!
     答:用Strings.Clear;
     
    3.ValueListeditor真是垃圾,用ValueListEditor1.Strings.Clear;后ValueListeditor的RowCount=2 一行是标题,另一行是空行
     答:后面用 InsertRow('测量时间', '0', True); 应该没有问题的
     
    4.比如某一行只有下拉框选项而不能直接输入
     答:用ItemProps['前置放大'].PickList.Add('ON');
            ItemProps['前置放大'].PickList.Add('OFF');
          或ItemProps['前置放大'].PickList:=sSpan;//sSpan : TStrings;
     
    5.以及Mask的用法 如何使输入显示*号
     答:用事件procedure TControlPanel.ParamEditorKeyPress(Sender: TObject; var Key: Char);
       和procedure TControlPanel.ParamEditorStringsChange(Sender: TObject); 控制
     
    6.如何选择行列
     答:当前选中的行通过Valuelisteditor1.row获得
       当前选中的列通过ValueListEditor1.col获得
     
    7.如何知道当前行的值
     答:ValueListEditor1当前行的值:ValueListEditor1.Keys[ValueListEditor1.Row]
     
    例子:
    unit Unit1;
     
    interface
     
    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, Grids, ValEdit;
     
    type
    TForm1 = class(TForm)
        VE: TValueListEditor;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
        procedure VEEditButtonClick(Sender: TObject);
    private
        { Private declarations }
    public
        { Public declarations }
    end;
     
    var
    Form1: TForm1;
     
    implementation
     
    {$R *.dfm}
     
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    VE.TitleCaptions.Strings[0]:='名称';
    VE.TitleCaptions.Strings[1]:='属性';
    VE.InsertRow('姓名','无名氏',true);
    VE.ItemProps['姓名'].EditStyle:=esSimple;
    //第一行代码让我们加入一个新行,第一个参数是Key值,第二个参数是Value的默认值。
    //第二行代码指出这是一个具有文本框风格的输入框。
    VE.InsertRow('出生年月','1982',true);
    VE.ItemProps['出生年月'].EditStyle:=esPickList;
    VE.ItemProps['出生年月'].PickList.Add('1982');
    VE.ItemProps['出生年月'].PickList.Add('1983');
    VE.ItemProps['出生年月'].PickList.Add('1984');
    VE.ItemProps['出生年月'].PickList.Add('1985');
    VE.ItemProps['出生年月'].ReadOnly:=true;
    //这几行代码让我们得到了一个具有下拉菜单风格的输入框。
    //第二项代码指出,这是一个具有下拦菜单风格的输入框,紧接着加入一些下拉选项,
    //最后一项代码指出其只能从下列项中选择而不准自行输入。
    //当然,VE->ItemProps["出生年月"] (其实是一个ItemProp对象)
    //它还具有一个EditMask的非常有用的属性。通过这个属性你可以定制输入。
    //EditMask的非常有用的属性。通过这个属性你可以定制输入。
    VE.InsertRow('地址','地球上的中国',true);
    VE.ItemProps['地址'].EditStyle:=esEllipsis;
    end;
     
    procedure TForm1.VEEditButtonClick(Sender: TObject);
    var
    strAddress:string;
    begin
    strAddress:=VE.Values[VE.Keys[VE.Row]];
    ShowMessage('欢迎您,来自'+strAddress+'的朋友!');
    end;
    end.
     
    指定某一栏
    ValueListEditor1.Col := 1;
    ValueListEditor1.Row := 3;
    ValueListEditor1.SetFocus;




  • 相关阅读:
    Python学习笔记(10):异常
    SharePoint中RichTextBox的Required验证
    Python学习笔记(6):模块
    Python学习笔记(4):控制流
    Python学习笔记(5):函数
    解决SharePoint中GridView导出Excel按钮的问题
    Python学习笔记(8):面向对象
    如何在SharePoint中创建Custom Master Page
    main cannot be resolved or is not a field
    c# 格式化输出字符串
  • 原文地址:https://www.cnblogs.com/xe2011/p/2527324.html
Copyright © 2011-2022 走看看