1. TreeView
- Posted by Tony Steward <figjam at nlc.net.au> Aug 13, 2000
- 506 views
- Last edited Aug 14, 2000
------=_NextPart_000_0019_01C00576.2BC6C2E0 boundary="----=_NextPart_001_001A_01C00576.2BC6C2E0" ------=_NextPart_001_001A_01C00576.2BC6C2E0 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Guys & Gals, I'm trying to figure this TreeView thingy. Attached is the start of my = program. The idea is it will take a line from a text file which is a = list of vehicle manufacturers and add it to the main (0) folder in = TreeView. Next it scans the database in feild 1, it finds a vehicle with = the same manufacturer it should make a secondary folder under that = manufacturer titled as the vehicle model. When finnished scanning the DB = it goes back to get the next line of the text file and so on. I've done = something wrong or I'm going about it the wrong way. I'm not up to = filling the list yet as I have to change the structure of the DB. Help please Tony ------=_NextPart_001_001A_01C00576.2BC6C2E0 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Hi Guys & Gals,</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I'm trying to figure this TreeView = thingy. Attached=20 is the start of my program. The idea is it will take a line from a text = file=20 which is a list of vehicle manufacturers and add it to the main (0) = folder in=20 TreeView. Next it scans the database in feild 1, it finds a vehicle with = the=20 same manufacturer it should make a secondary folder under that = manufacturer=20 titled as the vehicle model. When finnished scanning the DB it goes back = to get=20 the next line of the text file and so on. I've done something wrong or = I'm going=20 about it the wrong way. I'm not up to filling the list yet as I have to = change=20 the structure of the DB.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Help please</FONT></DIV> <DIV> </DIV> ------=_NextPart_001_001A_01C00576.2BC6C2E0-- ------=_NextPart_000_0019_01C00576.2BC6C2E0 name="program.zip"
2. Re: TreeView
- Posted by Wayne Overman <euman at BELLSOUTH.NET> Aug 13, 2000
- 472 views
------=_NextPart_000_0025_01C0054B.F1AB5F00 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello,=20 Below is a working example of the method I use in a database that is = similar to what I think you are going to use. I Create the .edb first in the example (obviously) and open the file to = gather the info created by the user (not all at once of course) but as you'll see this will take away from haveing the world see the = info in your text file and accomplish the same effect. If I can be of further assistance let me know. euman at bellsouth.net AKA Wayne Overman -- Begin Code ------------------------------------------------- include win32lib.ew include database.e --- Create the Database ----------------------------------- integer i, ii, i1, fn i1 =3D db_create("Automadb2",DB_LOCK_NO) ii =3D db_open("Automadb2",DB_LOCK_NO) i =3D db_create_table("Alfa Romeo") i =3D db_select_table("Alfa Romeo")=20 ii =3D db_insert("Spyder", {"Engine","Tires","Tranny"}) ii =3D db_insert("model #2", {"Engine","Tires","Tranny"}) i =3D db_create_table("BMW") i =3D db_select_table("BMW")=20 ii =3D db_insert("Model #1", {"Engine","Tires","Tranny"}) ii =3D db_insert("Anyother model", {"Engine","Tires","Tranny"}) fn =3D open("autoedb.txt", "w") db_dump(fn, 0) close(fn) db_close() --- Open to aquire info --------------------------------------- constant MainWin =3D create(Window, "Auto Program", 0, Default, Default, 800, = 600,0) atom TV TV =3D create(TreeView, "Treeview", MainWin, 10, 35, 200, 525, or_all({TVS_HASLINES, TVS_LINESATROOT, TVS_HASBUTTONS, TVS_SHOWSELALWAYS})) integer DONE, open_db, closefolder, openfolder=20 DONE =3D 0 open_db =3D -1 closefolder =3D addIcon( extractIcon( "clsdfold.ico" )) openfolder =3D addIcon( extractIcon( "openfold.ico" )) procedure Auto_DB_class() sequence Manufacturer_names, Machine_names, sub_class, folders integer get_table, fx, gx, count, table_size, sub_class_count Machine_names =3D {} sub_class =3D {} fx=3D1 gx=3D1 count=3D0 if DONE =3D 0 then =20 open_db =3D db_open("Automadb2",DB_LOCK_NO) Manufacturer_names =3D db_table_list()=20 folders =3D {} for x =3D 1 to length(Manufacturer_names) do ------This is the = (Automotive or any) manufacturer get_table =3D db_select_table(Manufacturer_names[x]) folders &=3D addTVItem( TV, closefolder, openfolder, = Manufacturer_names[x] , 0 ) =20 fx =3D x + count table_size =3D db_table_size() for i =3D 1 to table_size do ------------------------- This = could be the model / models of the manufacturer Machine_names =3D db_record_key(i)=20 folders &=3D addTVItem( TV, closefolder, openfolder, = Machine_names , folders[fx] ) sub_class =3D db_record_data(i) sub_class_count =3D length(sub_class) count +=3D 1 gx =3D x + count =20 for j =3D 1 to sub_class_count do -------This could = be any info on a particular Manufacturers Model i.e: Engine, Tires, = Trans etc. =20 folders &=3D addTVItem( TV, closefolder, = openfolder, sub_class[j] , folders[gx] ) count +=3D 1 =20 end for sub_class =3D {} Machine_names =3D {} end for end for =20 db_close()=20 DONE =3D 1 else=20 end if end procedure onOpen[MainWin]=3Droutine_id("Auto_DB_class") WinMain( MainWin, Normal ) --- End of Code = ------------------------------------------------------------ P.S there is a bug in Matts code=20 in win32lib.ew on line 9077 global function getParent( integer id ) return tvitem_owner[ id ] end function This should be: global function getParent( integer id ) return tvitem_parent[ id ] end function ----- Original Message -----=20 From: Tony Steward=20 To: EUPHORIA at LISTSERV.MUOHIO.EDU=20 Sent: Sunday, August 13, 2000 8:31 AM Subject: TreeView Hi Guys & Gals, I'm trying to figure this TreeView thingy. Attached is the start of my = program. The idea is it will take a line from a text file which is a = list of vehicle manufacturers and add it to the main (0) folder in = TreeView. Next it scans the database in feild 1, it finds a vehicle with = the same manufacturer it should make a secondary folder under that = manufacturer titled as the vehicle model. When finnished scanning the DB = it goes back to get the next line of the text file and so on. I've done = something wrong or I'm going about it the wrong way. I'm not up to = filling the list yet as I have to change the structure of the DB. Help please Tony ------=_NextPart_000_0025_01C0054B.F1AB5F00 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><FONT face=3DArial size=3D2> <DIV> <DIV><FONT face=3DArial size=3D2>Hello, </FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Below is a <U><FONT = color=3D#ff0000>working=20 example</FONT></U> of the method I use in a database that is similar to = what I=20 think you are going to use.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I Create the .edb first in the example = (obviously)=20 and open the file to gather the info created by the user (not all at = once of=20 course)</FONT></DIV> <DIV><FONT face=3DArial size=3D2>but as you'll see this will take away = from haveing=20 the world see the info in your text file and accomplish the same=20 effect.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>If I can be of further assistance let = me=20 know.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2><A=20 href=3D"mailto:euman at bellsouth.net">euman at bellsouth.net</A> AKA = Wayne=20 Overman</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>-- Begin Code=20 -------------------------------------------------</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>include win32lib.ew<BR>include=20 database.e</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>--- Create the Database=20 -----------------------------------</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>integer i, ii, i1, fn<BR>i1 =3D=20 db_create("Automadb2",DB_LOCK_NO)<BR>ii =3D=20 db_open("Automadb2",DB_LOCK_NO)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>i =3D db_create_table("Alfa = Romeo")<BR>i =20 =3D db_select_table("Alfa Romeo") <BR>ii =3D db_insert("Spyder",=20 {"Engine","Tires","Tranny"})<BR>ii =3D db_insert("model #2",=20 {"Engine","Tires","Tranny"})</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>i =3D = db_create_table("BMW")<BR>i =3D=20 db_select_table("BMW") <BR>ii =3D db_insert("Model #1",=20 {"Engine","Tires","Tranny"})<BR>ii =3D db_insert("Anyother model",=20 {"Engine","Tires","Tranny"})</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>fn =3D open("autoedb.txt", = "w")<BR>db_dump(fn,=20 0)<BR>close(fn)</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>db_close()</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>--- Open to aquire info=20 <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>constant<BR>MainWin =3D create(Window, = "Auto=20 Program", 0, Default, Default, 800, 600,0)</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>atom TV<BR>TV =3D create(TreeView, = "Treeview",=20 MainWin, 10, 35, 200, 525,<BR> or_all({TVS_HASLINES, = TVS_LINESATROOT,=20 <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>integer DONE, open_db, closefolder, = openfolder=20 <BR>DONE =3D 0<BR>open_db =3D -1<BR>closefolder =3D = addIcon(=20 extractIcon( "clsdfold.ico" ))<BR>openfolder =3D addIcon( = extractIcon(=20 "openfold.ico" ))</FONT></DIV> <DIV><FONT face=3DArial size=3D2><BR> </DIV></FONT><FONT = face=3DArial=20 size=3D2></FONT> <DIV><FONT face=3DArial size=3D2>procedure Auto_DB_class()<BR>sequence=20 Manufacturer_names, Machine_names, sub_class, folders<BR>integer = get_table, fx,=20 gx, count, table_size, sub_class_count<BR>Machine_names =3D = {}<BR>sub_class =3D=20 {}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>fx=3D1 gx=3D1 count=3D0</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>if DONE =3D 0 then<BR> <BR>open_db = =3D=20 db_open("Automadb2",DB_LOCK_NO)</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> = Manufacturer_names =3D=20 db_table_list() <BR> folders =3D {}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> for x =3D 1 to = length(Manufacturer_names) do <FONT color=3D#0000ff>------This is = the=20 (Automotive or any)=20 get_table =3D=20 nbsp; =20 folders &=3D addTVItem( TV, closefolder, openfolder, = Manufacturer_names[x] , 0=20 ) =20 <BR> fx =3D x + = count</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial = table_size =3D db_table_size()</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial=20 p; for i=20 =3D 1 to table_size do <FONT = color=3D#0000ff>------------------------- This=20 could be the model / models of the=20 bsp; =20 Machine_names =3D db_record_key(i)=20 sp; =20 folders &=3D addTVItem( TV, closefolder, openfolder, Machine_names , = folders[fx]=20 bsp; =20 sub_class =3D=20 p; =20 sub_class_count =3D=20 p; =20 count +=3D=20 bsp; =20 gx =3D x +=20 bsp; =20 </FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial=20 p; =20 for j =3D 1 to sub_class_count do<FONT color=3D#0000ff> = -------This could be=20 any info on a particular Manufacturers Model i.e: Engine, Tires, Trans=20 etc. =20 sp;=20 folders &=3D addTVItem( TV, closefolder, openfolder, sub_class[j] ,=20 folders[gx]=20 count +=3D 1 =20 sp; =20 end for</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial=20 p; =20 sub_class =3D=20 nbsp;=20 Machine_names =3D {}</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial=20 p; =20 end for<BR> end=20 for<BR> <BR> db_close()=20 </FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> DONE =3D = 1</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>else <BR>end if</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>end procedure</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial=20 <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>WinMain( MainWin, Normal = )<BR></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV>--- End of Code=20 ------------------------------------------------------------</DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2><STRONG><U>P.S there is a bug in Matts=20 code</U></STRONG> </FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV>in win32lib.ew on <FONT face=3DArial size=3D2>line = 9077</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>global function getParent( integer id=20 )<BR> return tvitem_owner[ id ]<BR>end = function</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial = size=3D2></FONT><BR><FONT=20 face=3DArial size=3D2><U>This should be:</U></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>global function getParent( integer id=20 )<BR> return tvitem_parent[ id ]<BR>end = function</FONT></DIV> <DIV><FONT face=3DArial size=3D2><BR> </DIV></FONT></DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A title=3Dfigjam at nlc.net.au href=3D"mailto:figjam at nlc.net.au">Tony = Steward</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUPHORIA at LISTSERV.MUOHIO.EDU=20 = </A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, August 13, 2000 = 8:31=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> TreeView</DIV> <DIV><BR></DIV> <DIV><FONT face=3DArial size=3D2>Hi Guys & Gals,</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I'm trying to figure this TreeView = thingy.=20 Attached is the start of my program. The idea is it will take a line = from a=20 text file which is a list of vehicle manufacturers and add it to the = main (0)=20 folder in TreeView. Next it scans the database in feild 1, it finds a = vehicle=20 with the same manufacturer it should make a secondary folder under = that=20 manufacturer titled as the vehicle model. When finnished scanning the = DB it=20 goes back to get the next line of the text file and so on. I've done = something=20 wrong or I'm going about it the wrong way. I'm not up to filling the = list yet=20 as I have to change the structure of the DB.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Help please</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial=20 ------=_NextPart_000_0025_01C0054B.F1AB5F00--
3. TreeView
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Jul 09, 2000
- 449 views
------=_NextPart_000_0009_01BFE9A8.C1564FE0 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable can treeview have different icon for every item? i wanna do that but = cant get it to work. also, how can i detect message that user has selected another item (with = mouse) in treeview? ------=_NextPart_000_0009_01BFE9A8.C1564FE0 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-2" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>can treeview have different icon for = every item? i=20 wanna do that but cant get it to work.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>also, how can i detect message that = user has=20 selected another item (with mouse) in = ------=_NextPart_000_0009_01BFE9A8.C1564FE0--
4. Re: TreeView
- Posted by wolfgang fritz <wolfritz at KING.IGS.NET> Jul 09, 2000
- 455 views
Thanks to Mathew Lewis, ...change the mask variable to: mask = or_all( {TVIF_IMAGE, TVIF_PARAM, TVIF_TEXT, TVIF_CHILDREN, TVIF_SELECTEDIMAGE}) ...and different icons for items should work. Wolf > can treeview have different icon for every item? i wanna do that but cant get it to work.
5. Re: TreeView
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Jul 10, 2000
- 482 views
=A9koda wrote: >can treeview have different icon for every item? i wanna do that but = cant get it to work. As Wolfgang alluded, just add more icons using ILAddIcon(). = Unfortunately, I haven't gotten around to wrapping the treeview very elegantly yet = (I've got some better listview wrappers up at http://members.xoom.com/matthewlewis/projects.html ). Here's a little explanation: When I wrote the demo, I only used one icon (it's index was 0 as far as = the win32 API was concerned), so I didn't really need to select an image, = and I only specified the normal icon, and not the icon to be displayed when = the item is selected. This will eventually be hidden from the user, but = for now, you need to worry about the mask value. This tells windows what = parts of the TV_ITEM structure it needs to look at. In my original demo, I = hadn't specified the TVIF_SELECTEDIMAGE, so it would default to the first icon added (thanks to Wolfgang for bringing this to my attention). = Currently, the programmer needs to keep track of icon indices. I expect this to = be wrapped, again, similar to what I've done with the listview. mask =3D or_all( {TVIF_IMAGE, TVIF_PARAM, TVIF_TEXT, TVIF_CHILDREN, TVIF_SELECTEDIMAGE}) items[1] =3D insertTVItem( TV, mask, 0, 0, 0, "Test 1", 3, 2, 1, 1,=20 TVI_ROOT, TVI_FIRST) >also, how can i detect message that user has selected another item = (with mouse) in treeview? You need to trap the WM_NOTIFY message that the treeview sends to it's owner. You'll need to create an onEvent() proc for the window that is = the owner of the treeview, and look for TVN_SELCHANGED within the NMHDR structure (again, take a look at the listview demo I've put up). You'll be pointed to an NM_TREEVIEW structure (which I haven't wrapped, = yet, either, but would look like this: constant NMTREEVIEW_hdr =3D allot( Long ), NMTREEVIEW_action =3D allot( UInt ), NMTREEVIEW_itemOld =3D allot( SIZEOF_TVITEM), NMTREEVIEW_itemNew =3D allot( SIZEOF_TVITEM ), NMTREEVIEW_ptDrag =3D allot( SIZEOF_POINT ) Note that itemOld itemNew and ptDrag are actually structures them = selves. To get the items in there, use them the structure names, and use the structure elements of TV_ITEM's and a POINT structure to get the = values. The action member will return one of the following values, which = specifies how the item was selected, if you're interested: TVC_BYKEYBOARD By a key stroke TVC_BYMOUSE By a mouse click TVC_UNKNOWN Unknown I don't think I included these values, but you should be able to find definitions for them in winconst.ew, by Jacques Deschenes, which is in = the archives. Hopefully, this will help you. Let me know if you need any = more help. I'd also appreciate if you (and everyone else) let me know how = you're using listviews and treeviews, so I can better wrap everything. Right now I'm working on some drag and drop functionality. It looks = like the only way to have windows do it is to define OLE objects, which = looks to be beyond my capabilities (if it's even possible in Eu). But I think I = see a way to emulate it fairly easily. Matt Lewis