1. Nesting Question?
- Posted by Wayne Overman <euman at BELLSOUTH.NET> Jul 26, 2000
- 416 views
------=_NextPart_000_000E_01BFF739.3F5E3B80 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 Hello, I sure hope there is an easy way out of this one..... I am useing Win32lib by David Cuny with the Treeview/Listview extensions = by Matt Lewis. How can I return the [ ID's ] of the Parent and Grand Parent of a child = or, if the parent is selected how would I get the Grand Parent's ID. I'm not sure Grand Parent is appropriate terminology but should give you = a better understanding of the nesting im trying to return.. I currently have twenty or so line to achieve what I'm after but, it's = much too redundant. --- Help euman at bellsouth.net -- This is the method I used to create multi-level Treeviews (Grand = Parent (Parent (Child))) based on how my info is stored in a .EDB file. for x =3D 1 to length(Manufacturer_names) do get_table =3D db_select_table(Manufacturer_names[x]) folders &=3D addTVItem( TV, closefolder, openfolder, = Manufacturer_names[x] , 0 ) -- Grand Parent (could be multiple) =20 fx =3D x + count for i =3D 1 to db_table_size() do Machine_names =3D db_record_key(i)=20 folders &=3D addTVItem( TV, closefolder, openfolder, = Machine_names , folders[fx] ) -- Parent (could be multiple) sub_class =3D db_record_data(i) count +=3D 1 gx =3D x + count for j =3D 1 to length( sub_class ) do = =20 folders &=3D addTVItem( TV, closefolder, = openfolder, sub_class[j] , folders[gx] ) -- Child (could be multiple) count +=3D 1 =20 end for sub_class =3D {} Machine_names =3D {} end for end for ------=_NextPart_000_000E_01BFF739.3F5E3B80 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV> <DIV><FONT face=3DArial size=3D2> </FONT></DIV> <DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I sure hope there is an easy way out of = this=20 one.....</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I am useing Win32lib by David Cuny with = the=20 Treeview/Listview extensions by Matt Lewis.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>How can I return the [ ID's ] = of the=20 Parent and Grand Parent of a child or, if the parent is selected=20 how would I get the Grand Parent's ID.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I'm not sure Grand Parent is = appropriate=20 terminology but should give you a better understanding of the nesting im = trying=20 to return..</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I currently have twenty or so line to=20 achieve what I'm after but, it's much too redundant. ---=20 Help</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2><A=20 <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>-- This is the method I used to create = multi-level=20 Treeviews (Grand Parent (Parent (Child))) based on how my info is stored = in a=20 .EDB file.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> for x =3D 1 to=20 length(Manufacturer_names)=20 do<BR> get_table =3D=20 nbsp; =20 folders &=3D addTVItem( TV, closefolder, openfolder, = Manufacturer_names[x] , 0=20 ) -- Grand Parent (could be=20 =20 fx =3D x + count</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial=20 p; for i=20 =3D 1 to db_table_size()=20 nbsp; =20 Machine_names =3D db_record_key(i)=20 sp; =20 folders &=3D addTVItem( TV, closefolder, openfolder, Machine_names , = folders[fx] ) -- Parent (could be=20 =20 sub_class =3D=20 p; =20 count +=3D=20 bsp; =20 gx =3D x + count</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial=20 p; =20 for j =3D 1 to length( sub_class )=20 folders &=3D addTVItem( TV, closefolder, openfolder, sub_class[j] ,=20 folders[gx] ) -- Child (could be=20 nbsp;=20 count +=3D=20 nbsp; =20 sp; =20 end for</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial=20 p; =20 sub_class =3D=20 nbsp;=20 Machine_names =3D {}</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial=20 p; =20 end for<BR> end=20 ------=_NextPart_000_000E_01BFF739.3F5E3B80--
2. Re: Nesting Question?
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Jul 27, 2000
- 397 views
-----Original Message----- From: Wayne Overman >How can I return the [ ID's ] of the Parent and Grand Parent of a child or, if the parent is >selected how would I get the Grand Parent's ID. >I'm not sure Grand Parent is appropriate terminology but should give you a better understanding of >the nesting im trying to return.. This is another thing that hasn't really been wrapped, but by adding: global function getParent( integer id ) return tv_parent[ id ] end function to win32lib, you can get the id of a parent. If the return is zero, then the item has no parent. Matt Lewis
3. Re: Nesting Question?
- Posted by Wayne Overman <euman at BELLSOUTH.NET> Jul 27, 2000
- 398 views
Hello, I inserted the code below and no matter what TV, deep in a nest or not has always returned 41) as the parent_id This is how i tried the code: index = getTVIndex( TV ) -- this is the current (selected) TV parent = getParent( index ) -- this should have been the parent of index am I right? Instead 41 kept comeing up. So, I experimented some and found that global function getParent( integer id ) return tvitem_parent[ id ] end function does work...... Thanks Matt for putting me in the right direction. > >From: Wayne Overman > >How can I return the TV (treeview) [ ID's ] of the Parent and Grand Parent of a child ? > From Matt Lewis > This is another thing that hasn't really been wrapped, but by adding: > global function getParent( integer id ) > return tvitem_owner[ id ] > end function > to win32lib, you can get the id of a parent. If the return is zero, then the item has no parent. > Matt Lewis