Reply to: adayuer ([± 0 ° C]) () Reputation: 96 2002-04-01 09: 40: 17Z score: 0 Look at my code. The group of contacts that implemented with TtreeView, contacts TLISTVIEW. / --------------------------------------------------- -------------------------- void __fastcall ttbf :: n5click (Tobject * sender) {thittests ht; ttreenode * node1; if (mouse_sender && mouse_sender-> ClassNameIs ( "TTreeView")) {TTreeView * pTV = (TTreeView *) mouse_Sender; HT = pTV-> GetHitTestInfoAt (mouse_x, mouse_y); if (HT.Contains (htOnItem)) Node1 = pTV-> GetNodeAt (mouse_x, mouse_y) ; If (node1-> text == "all") {messagedlg ("///" is a system group, can't delete! ", MTWARNING, TMSGDLGBUTTONS () << mbyes, 0);} else PTV -> Items-> delete (node1);
}} // ---------------------------------------------- ----------------------------- void __fastcall ttbf :: GrouptVMousedown (Tobject * Sender, TMousebutton Button, TshiftState Shift, Int x, int Y) {mouse_x = x; mouse_y = y; mouse_sender = sender;} // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------- Void __fastcall ttbf :: n3click TObject * Sender) {THitTests HT; TTreeNode * Node1; if (mouse_Sender && mouse_Sender-> ClassNameIs ( "TTreeView")) {TTreeView * pTV = (TTreeView *) mouse_Sender; HT = pTV-> GetHitTestInfoAt (mouse_x, mouse_y); if (HT .Contains (htonitem)) {node1 = ptv-> getnodeat (mouse_x, mouse_y); if ((node1-> level == 0) && (node1-> text == "all")) {messagedlg ("/" all / "Is the system group, can not be new subsidy!", MTWARNING, TMSGDLGBUTTONS () << mbyes, 0); return;} if (node1-> level == 1) {Messagedlg ("can only establish two levels! "MTWARNING, TMSGDLGBUTTONS () << mbyes, 0); returno} else {ttreenod e * fnode; string s = "new group"; fnode = node1-> getFirstChild (); if (fnode) While (! NOSAMENAME (FNode, s)) {;}; ptv-> items-> addchild (node1, S);}}}} // ----------------------------------------- --------------------------------- void __fastcall ttbf :: n2click (Tobject * sender) {Ttreenode HT; TTREENODE * Node1; if (mouse_sender && mouse_sender-> classnameis ("ttreeview * ptv = (ttreeView *) mouse_sender; ht = ptv-> gethitteTestinfoat (mouse_x, mouse_y);
IF (ht.contains (htonitem)) {node1 = ptv-> getnodeat (mouse_x, mouse_y); string s = "new group"; while (! NOSAMENAME (node1, s)) {;}; ptv-> items- > Add (node1, s);}}} // ----------------------------------- -------------------------------------- void __fastcall ttbf :: n4click (TOBJECT * Sender) { THitTests HT; TTreeNode * Node1; if (mouse_Sender && mouse_Sender-> ClassNameIs ( "TTreeView")) {TTreeView * pTV = (TTreeView *) mouse_Sender; HT = pTV-> GetHitTestInfoAt (mouse_x, mouse_y); if (HT.Contains (htOnItem) ) {Node1 = ptv-> getnodeat (mouse_x, mouse_y); if ((node1-> level == 0) && (node1-> text == "all")) {messagedlg ("/" all / "is a system group Can't rename! ", MTWARNING, TMSGDLGBUTTONS () << mbyes, 0);} else node1-> edittext ();}}
} // ----------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------- void __fastcall ttbf :: grouptvclick (Tobject * sender) {/ * thittests ht; ttreenode * node1; if (Sender-> ClassNameis ("TtreeView")) {TTREEVIEW * PTV = (TtreeView *) sender; ht = ptv-> gethittestinfoat (mouse_x, mouse_y); if (ht.contains (htonitym)) {node1 = ptv-> getnodeat (mouse_x, mouse_y); sb-> simpletext = "absoluteindex:" INTOSTR (Node1-> AbsoluteIndex) "/ TINDEX:" INTOSTR (Node1-> index) "/ TTEXT [" node1-> text "] "}} * /} // ----------------------------------------- ----------------------------------
void __fastcall TTBF :: GroupTVChange (TObject * Sender, TTreeNode * Node) {// SB-> SimpleText = "Count:" IntToStr (Node-> Count) "AbsoluteIndex:" IntToStr (Node-> AbsoluteIndex) " Index: " INTOSTR (Node-> Index) " Text [" Node-> Text "] "; TListItem * Pitem; String Tmp; TBLV-> items-> clear (); if ((Node-> text = = "All" && Node-> Level == 0)) {for (int i = 0; i
Items [i])) -> phone)); Pitem-> Subitems-> Add (String ((telitem *) (m-> tblist-> items [i])) -> type == 0)? " English: "Chinese")); Pitem-> Subitems-> Add (String ((telitem *) (m-> tblist-> items [i])) -> MEMO));} return;} else f Node-> level == 1) {TTREENODE * PNODE = Node-> Parent; for (int i = 0; i