E
emailqjc
Unregistered / Unconfirmed
GUEST, unregistred user!
请问高手如何创建动态菜单,为什么我创建的,用Find不能判断呢,tem:=Caption;
if pos('(',Caption)>0 then
tem:=copy(Caption,1,length(Caption)-4);
//Caption:=copy(Caption,1,length(Caption)-4);
Result := mMenu.Find(tem);
if (Result = nil) and (not ExitisItem(tem,Lb_MenuItem))then
//if (Result = nil) then
begin
Result := TMenuItem.Create(mMenu);
Result.Caption := Caption;
mMenu.Add(Result);
self.Lb_MenuItem.Items.Add(Result.Caption);
Result.OnClick := nEvent;
end;
Result.Checked := True;
if pos('(',Caption)>0 then
tem:=copy(Caption,1,length(Caption)-4);
//Caption:=copy(Caption,1,length(Caption)-4);
Result := mMenu.Find(tem);
if (Result = nil) and (not ExitisItem(tem,Lb_MenuItem))then
//if (Result = nil) then
begin
Result := TMenuItem.Create(mMenu);
Result.Caption := Caption;
mMenu.Add(Result);
self.Lb_MenuItem.Items.Add(Result.Caption);
Result.OnClick := nEvent;
end;
Result.Checked := True;