我正做一个控件,申明部分:TMyComponent = class(TComponent)
  private
    FShortCut: TShortCut;
  protected
  public
    constructor Create(AOwner: TComponent);override;
    destructor Destroy;override;
  published
    property ShortCut: TShortCut read FShortCut write FShortCut default 0;
end;实现部分:constructor Create(AOwner: TComponent);
begin
  inhertied;
  FShortCut := 0;
end;destructor Destroy;
begin
  inherited;
end;
问题在于:
    安装后,在属性 编辑器里不能象TMenuItem里的ShortCut那样选择按键,只能输入数字,这是为什么?希望高手指点!

解决方案 »

  1.   

    The optional stored, default, and nodefault directives are called storage specifiers. They have no effect on program behavior, but control whether or not to save the values of published properties in form files.The stored directive must be followed by True, False, the name of a Boolean field, or the name of a parameterless method that returns a Boolean value. For example,property Name: TComponentName read FName write SetName stored False;If a property has no stored directive, it is treated as if stored True were specified.The default directive must be followed by a constant of the same type as the property. For example,property Tag: Longint read FTag write FTag default 0;To override an inherited default value without specifying a new one, use the nodefault directive. The default and nodefault directives are supported only for ordinal types and for set types, provided the upper and lower bounds of the set's base type have ordinal values between 0 and 31; if such a property is declared without default or nodefault, it is treated as if nodefault were specified. For reals, pointers, and strings, there is an implicit default value of 0, nil, and '' (the empty string), respectively.NoteYou can't use the ordinal value 2147483648 has a default value. This value is used internally to represent nodefault.When saving a component's state, the storage specifiers of the component's published properties are checked. If a property's current value is different from its default value (or if there is no default value) and the stored specifier is True, then the property's value is saved. Otherwise, the property's value is not saved.NoteProperty values are not automatically initialized to the default value. That is, the default directive controls only when property values are saved to the form file, but not the initial value of the property on a newly created instance.Storage specifiers are not supported for array properties. The default directive has a different meaning when used in an array property declaration. See Array properties.
      

  2.   

    TShourCut是一个什么样的类型?
      

  3.   

    to FrameSniper:
     你说的东西好象和我说的问题不相关吧!
      

  4.   

    To HKBarton
      TShortCut是一个枚举类型  对于枚举类型的属性在使用Default时没有特殊的规则!
      

  5.   

    To Nyf1220  偶知道你外语不好,要不也不用这么晚才考六级了,哈哈哈哈!  回去搞你的B-树去,少在这里捣乱!
      

  6.   

    问题解决了,自己注册了一个属性编辑器,直接利用自带的TShortCutPropertyEditor