不 不知火舞 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-29 #1 请问TreeView中如何控制PopupMenu,使其只有在选择了树的结点后点右键才出现? 如果点在TreeView的空白区,PopupMenu要不显示出来。 谢谢!
L lanbing1400 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-29 #2 判断焦点,如果有节点得到焦点,为TreeView连接PopupMenu,否则一概清除原有设置
Z zhousi Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-29 #3 if TV_jr_tree.selected<>nil then begin end;
S spymaster Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-29 #4 if not TreeView.Selected.Selected then Exit; if not TreeView.Selected.HasChildren then Exit;
S Shuzi Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-29 #5 写TreeView的OnContextPopup事件,如: procedure TForm1.TreeView1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean); begin Handled:=(htNowhere in TreeView1.GetHitTestInfoAt(MousePos.X,MousePos.Y)); end;
写TreeView的OnContextPopup事件,如: procedure TForm1.TreeView1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean); begin Handled:=(htNowhere in TreeView1.GetHitTestInfoAt(MousePos.X,MousePos.Y)); end;
C cyf_00002 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-29 #6 procedure TForm1.TreeView1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var nodx:ttreenode; begin nodx:=treeview1.GetNodeAt(x,y); if nodx=nil then showmessage('no') else showmessage('yes'); end;
procedure TForm1.TreeView1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var nodx:ttreenode; begin nodx:=treeview1.GetNodeAt(x,y); if nodx=nil then showmessage('no') else showmessage('yes'); end;
饿 饿狼传说 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-29 #7 procedure TForm1.TreeView1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var nodx:ttreenode; begin nodx:=treeview1.GetNodeAt(x,y); if nodx <> nil then treeview1.PopupMenu := popupmenu1 else treeview1.PopupMenu := nil; end;
procedure TForm1.TreeView1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var nodx:ttreenode; begin nodx:=treeview1.GetNodeAt(x,y); if nodx <> nil then treeview1.PopupMenu := popupmenu1 else treeview1.PopupMenu := nil; end;
K kingson Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-08 #8 怎麼實現這樣的結構用treeview: +一級部門 +二級部門 -張三 -李四