J
jxauyhj
Unregistered / Unconfirmed
GUEST, unregistred user!
没有ContextPopup事件 只好再mousedown事件中写,但是总要单击两次才有右键菜单,而且用左键单击菜单事件时这里也回执行 好像Button = mbright 没有用? 请问该怎么解决?
TfcTreeView(TreeView).PopupMenu := nil;
if Button = mbright then
begin
if TreeView.MultiSelectListCount > 0 then
begin
//-------begin判断是否是同级
NodeLevel :=TreeView.MultiSelectList[0].Level;
for i := 1 to Treeview.MultiSelectListCount-1 do
begin
NextNodelevel := TreeView.MultiSelectList.Level;
if NodeLevel <> NextNodelevel then
begin
MessageDlg('只能选择同级分析!',mtWarning,[mbok],0);
exit;
end;
if not (Tnodeinfo(TreeView.MultiSelectList.Data).nodeType
in [firstgroup,SecondGroup,AllNet] ) then
begin
MessageDlg('只能选择代维,组,人员分析!',mtWarning,[mbok],0);
exit;
end;
end;
//--------end;
//判断
if TreeView.MultiSelectListCount > 1 then
singleormulti :=2
else singleormulti :=1 ;
CreatePOPMenu(Tnodeinfo(TreeView.MultiSelectList [0].Data).nodeType,singleormulti); //测试
TfcTreeView(TreeView).PopupMenu := POPUPMenu;
end;
end;
TfcTreeView(TreeView).PopupMenu := nil;
if Button = mbright then
begin
if TreeView.MultiSelectListCount > 0 then
begin
//-------begin判断是否是同级
NodeLevel :=TreeView.MultiSelectList[0].Level;
for i := 1 to Treeview.MultiSelectListCount-1 do
begin
NextNodelevel := TreeView.MultiSelectList.Level;
if NodeLevel <> NextNodelevel then
begin
MessageDlg('只能选择同级分析!',mtWarning,[mbok],0);
exit;
end;
if not (Tnodeinfo(TreeView.MultiSelectList.Data).nodeType
in [firstgroup,SecondGroup,AllNet] ) then
begin
MessageDlg('只能选择代维,组,人员分析!',mtWarning,[mbok],0);
exit;
end;
end;
//--------end;
//判断
if TreeView.MultiSelectListCount > 1 then
singleormulti :=2
else singleormulti :=1 ;
CreatePOPMenu(Tnodeinfo(TreeView.MultiSelectList [0].Data).nodeType,singleormulti); //测试
TfcTreeView(TreeView).PopupMenu := POPUPMenu;
end;
end;