begini caranya (biar yang lain bisa belajar juga ya ;))

1. Letakkan component Menu di form, dan atur isi menu
2. Letakkan component TreeView di form.
3. Letakkan component Button di form
4. Isikan event onclick pada Button seperti ini :

procedure TForm1.Button1Click(Sender: TObject);
var
 index,index2:integer;
 MenuItem:TMenuItem;
 Node,Child:TTreeNode;
begin
 //ambil semua menu utama 
 for index:=0 to MainMenu1.Items.Count-1 do
  begin
   //ambil menu ke [index];
   MenuItem:=MainMenu1.Items[index];
   //ini bikin root sibling
   Node:=TreeView1.Items.Add(nil,MainMenu1.Items[index].Caption);
   //ambil semua sub menu dari menu [index]
   for index2:=0 to MenuItem.Count - 1 do
    begin
     //ini bikin child dari sibling yang ditunjuk oleh Node
     TreeView1.Items.AddChild(Node,MenuItem[index2].Caption);
    end;
  end;
end;

3. Kompile, jalankan program, terus klik tombol Button, pops... isi menu
pindah ke treeview. 

HTH

edhinug

> -----Original Message-----
> From: << Devy A >> [mailto:[EMAIL PROTECTED] 
> Sent: 14 Oktober 2003 16:23
> To: [EMAIL PROTECTED]
> Subject: RE: [Delphindo] tree menu ( seperti tree file)
> 
> 
> Bisa nggak kita import isi treeview dari Mainmenu ???


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

Berlangganan: [EMAIL PROTECTED]
Stop Berlangganan: [EMAIL PROTECTED]
Keluhan Milis(Unbouncing,spam,dll): [EMAIL PROTECTED] 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


Kirim email ke