我现在用的是delphi7。以下是练习过程中的问题:
1。对一些系统设定的值有些地方用[value],有些地方直接用value。这怎么区分,选择呢?
  如:
    type TNavigateBtn = (nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh);或者:
   const
      VisibleButtonArray:Array[0..9] of TButtonSet=(
            [nbFirst], [nbPrior], [nbNext], [nbLast], [nbInsert],
            [nbDelete], [nbEdit], [nbPost], [nbCancel], [nbRefresh]) ;
  而这里的常量声明是带[]的。2。Locate的模糊查询
   我用了DBDEMOS的animals.dbf。这样用了Locate:
//-----------------------------------
procedure TForm1.Button7Click(Sender: TObject);
var
  lo:TLocateOptions;
begin
  if Checkbox3.Checked  then
     Include(lo,loCaseInsensitive)
  else
     Exclude(lo,loCaseInsensitive);
  if checkbox2.Checked  then
     Include(lo,loPartialKey)
  else
     Exclude(lo,loPartialKey);  with Table1 do
  begin
    if Locate('FirstName;LastName',VarArrayof([edtFirstName.Text,edtLastName.Text ]),lo) then
      Label4.Caption :='查找成功'
    else
      Label4.Caption :='查找失败';
  end;但FirstName不支持模糊查询,LastName支持模糊查询3。怎么样实现强制转换。比如将一个整型数转换成浮点数。谢谢!

解决方案 »

  1.   

    1 type TNavigateBtn = (nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh);//这个是枚举类型 const
          VisibleButtonArray:Array[0..9] of TButtonSet=(
                [nbFirst], [nbPrior], [nbNext], [nbLast], [nbInsert],
                [nbDelete], [nbEdit], [nbPost], [nbCancel], [nbRefresh]) ;
    要看它TButtonSet是这样定义的:TButtonSet = set of TNavigateBtn; 是一个集合。
    VisibleButtonArray就是一个集合的一维数组,集合的元素要用[]括起来。2 但FirstName不支持模糊查询,LastName支持模糊查询
      ---------
      不知道为什么,你改用ADOTable试一下3 直接赋值就可以转换,例如:
    var a:integer;
        b:real;
    begin
      a:=10;
      b:=a;
    end;
      

  2.   

    1.是不是说array[0..9]分别对应nbFirst], [nbPrior], [nbNext], [nbLast], [nbInsert],
                [nbDelete], [nbEdit], [nbPost], [nbCancel], [nbRefresh]?2.但FirstName不支持模糊查询,LastName支持模糊查询
      ---------
      不知道为什么,你改用ADOTable试一下
    难道说问题来自locate,而非我的使用错误?3.还有没有其他方式的转换呢?