就是说,我设计的一个控件的一个属性是STRING类型,要从另一个TSTRINGS类型的变量中选择,TSTRINGS类型的变量的内容由另一个属性维护,就象TNOTEBOOK中的ACTIVEPAGE一样内容由PAGES维护一样,我如何把TSTRING中的内容加到那个STRING的下拉框中来选,
解决方案 »
- 如何用Random在FORM中随机显示图片
- 请问怎么样让托盘图标一闪一闪的,就像qq来消息时那样?
- 怎么把程序编译成。EXE文件???
- 如何使用TComboBoxEx.Data属性
- project 和form1的问题,可能是代码出问题了,请大家帮找找问题,先谢谢...
- PageControl使用问题
- 无法为更新行集定位:一些值可能已在最后读取后改变--怎么解决
- 关于用DELPHI联接ACCESS数据库怎样使用insert命令的问题(很急很急)加分多多!!!
- 高手指教:delphi6导入activex问题!
- 杀完NIMDA以后,OFFICE为什么不能用?急!!!
- 求职:广州有没有公司请Delphi或PHP程序员呢?
- ■■■■■■■■■■■■■-【属性编辑器(TPropertyEditor)问题】-★★★★★★★★★★★★★★★★★^______^- 春节快乐 -★★★
String的类型是没有的。
而想不起来也不大合理呀,你的一个属性是String的,直接赋给它不是就了,用一个下拉列表能表达吗,有什么用处呢。
TMyStringProperty = class(TStringProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure GetValues(Proc: TGetStrProc); override;
end;
{ TMyStringProperty }function TMyStringProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paValueList, paSortList];
end;
procedure TMyStringProperty.GetValues(Proc: TGetStrProc);
var
I: Integer;
StrList: TStringList;
begin
StrList := TYourComponent(GetComponent(0)).StringList;
for I := 0 to StrList.Count - 1 do
Proc(StrList[I]);
end;
var
I: Integer;
begin
for I := 0 to PageList.Count - 1 do
TMyPage(PageList[I]).Free;
PageList.Clear;
end;constructor TPageAccess.Create(APageList: PList; ANotebook: TMyBook);
begin
inherited Create;
PageList.Add(APageList);
Notebook := ANotebook;
end;procedure TPageAccess.Delete(Index: Integer);
var
Form: TCustomForm;
begin
TMyPage(PageList[Index]).Free;
PageList.Delete(Index);
NoteBook.PageIndex := 0; if csDesigning in NoteBook.ComponentState then
begin
Form := GetParentForm(NoteBook);
if (Form <> nil) and (Form.Designer <> nil) then
Form.Designer.Modified;
end;
end;function TPageAccess.Get(Index: Integer): string;
begin
Result := TMyPage(PageList[Index]).Caption;
end;function TPageAccess.GetCount: Integer;
begin
Result := PageList.Count;
end;function TPageAccess.GetObject(Index: Integer): TObject;
begin
Result := PageList[Index];
end;procedure TPageAccess.Insert(Index: Integer; const S: string);
var
Page: TMyPage;
Form: TCustomForm;
begin
Page := TMyPage.Create(Notebook);
with Page do
begin
Parent := Notebook;
Caption := S;
end;
PageList.Insert(Index, Page); NoteBook.PageIndex := Index; if csDesigning in NoteBook.ComponentState then
begin
Form := GetParentForm(NoteBook);
if (Form <> nil) and (Form.Designer <> nil) then
Form.Designer.Modified;
end;
end;procedure TPageAccess.Move(CurIndex, NewIndex: Integer);
var
AObject: TObject;
begin
if CurIndex <> NewIndex then
begin
AObject := PageList[CurIndex];
PageList[CurIndex] := PageList[NewIndex];
PageList[NewIndex] := AObject;
end;
end;procedure TPageAccess.Put(Index: Integer; const S: string);
begin
TMyPage(PageList[Index]).Caption := S;
end;procedure TPageAccess.SetUpdateState(Updating: Boolean);
begin
// inherited;end;
我做的属性编辑器时一个扩展TreeView的Items的编辑器,
功能和TreeView的Items的编辑器功能一样,只是添加了一个属性。