Arsip: [ask]menampilkan table kategori kedalam treeview??

 
user image
more 16 years ago

gedoyman

para master, cara bikin menu categories pada gambar dibawah ini gimana sih http://i140.photobucket.com/albums/r34/gedoyman/tree.gif menu categories tersebut diambil dari tabel categories. Trus kalo diklik salah satu category bakal otomatis tampilin materialnya. plis, udah coba2 masih kagak ngarti
user image
more 16 years ago

zieborg

pake treeview bisas bisa, cuma codingnya panjang, paling gampang pake komponen tambahan aja. yang free dapat di ambil di http://table-report.com/downloads/dbtreeview.zip
user image
more 16 years ago

mas_kofa


//code of delphi
type
   TPPROCESSNODE = ^TPROCESSNODE;
  TPROCESSNODE  = record
    ID         : Integer;
    NAME       : string;
    NODETYPE   : string;
    MACTYPE    : Integer;
    PARENT     : Integer;
    EXPRESSION : string;
    PREVPROC   : Integer;
    PARTOF     : Integer;
    TIMEVARVAL : Real;
    COLOR      : TColor;
    USED       : byte;
  end;
  ibq := NewQuery;
  ibq.SQL.Text := 'select * from PROCESSNODE order by Parent, id';
  ibq.Open;
  New(PN);
  PN^.ID       := 0;
  PN^.NAME     := 'Process List';
  PN^.NODETYPE := 'Root';
  PN^.PREVPROC := -1;
  
  DT := TVProcList.Items.Add(nil,'Process List');
  DT.Data := PN;
  cmBoxPrevProc.Items.Add('Begin Process');
  PrevProc_List.Add('-1');
  while not ibq.Eof do
  begin
    New(PN);
    PN^.ID         := FieldToInt(ibq,'id');
    PN^.NAME       := FieldToStr(ibq,'Name');
    PN^.NODETYPE   := FieldToStr(ibq,'NodeType');
    PN^.MACTYPE    := FieldToInt(ibq,'MACTYPE');
    PN^.PREVPROC   := FieldToInt(ibq,'PREVPROC');
    PN^.EXPRESSION := FieldToStr(ibq,'EXPRESSION');
    PN^.PARTOF     := FieldToInt(ibq,'PARTOF');
    PN^.USED       := FieldToInt(ibq,'USED');
    PN^.TIMEVARVAL := FieldToFloat(ibq,'TIMEVARVAL');
    PN^.COLOR      := FieldToInt(ibq,'COLOR');
    PN^.PARENT     := FieldToInt(ibq,'parent');
    Parent := PN^.PARENT;
    ParentDT := GetNodeParent(Parent);
    DT  := TVProcList.Items.AddChild(ParentDT,ibq['name']);
    DT.Data := PN;
    TVProcList.SetChecked(DT, PN^.USED = 1);
    if ibq['NodeType'] = 'Process' then
    begin
      cmBoxPrevProc.Items.Add(ibq['Name']);
      PrevProc_List.Add(IntToStr(PN.ID));
    end;
    ibq.Next;
  end;
  ibq.Free;

//tabel
CREATE TABLE "PROCESSNODE" 
(
  "ID"	 INTEGER NOT NULL,
  "NAME"	 VARCHAR(30),
  "NODETYPE"	 VARCHAR(15),
  "MACTYPE"	 INTEGER,
  "PARENT"	 INTEGER,
  "PREVPROC"	 INTEGER,
  "EXPRESSION"	 VARCHAR(200),
  "PARTOF"	 INTEGER,
  "TIMEVARVAL"	 DOUBLE PRECISION,
  "COLOR"	 INTEGER,
  "USED"	 INTEGER,
CONSTRAINT "PK_PROCESSNODE" PRIMARY KEY ("ID")
);
screenshot
user image
more 16 years ago

jrp

Bisa juga dengan menggunakan TJvDBTreeView dari paket JVCL. jrp
more ...
  • Pages:
  • 1
Share to

AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com