Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Tree Control Example
cSelectTVItem ============== There should be 5 files in the zip file. CDSWilEx.DLL - A WIL Extender containing the cSelectTVItem function. CDSWilx2.DLL - Search engine. WWCTL32I.DLL - This is the most current version of Ctrl Manager. Definitely worth having! SetTree.HLP - Kind'a sleazy, but I think it will get you going. Readmefirst.txt Use with Win95 and later, and WinNT 3.51 and later. Place the DLL's in your Windows System directory or your Winbatch\System directory. WinNT - WINNT\SYSTEM32 Win95 - WINDOWS\SYSTEM Update your WIL.CLR file with: cSelectTVItem=EXT All samples in the help file work. But be aware that when you cut and paste an example, occasionally a word processor editing character can get copied an the Winbatch interpreter may let you know. Just type the sample in to solve that problem. I have tried to test cSelecTVItem as throughly as possible, but ... WARNING ******KNOWN ISSUE****** WARNING **************************************************************************** When traversing a tree that has inactive items, (those "grayed out" elements) a tree search by value can hang up on the last item in the tree. If this happens, through PVIEW or Task Manager, kill the script AND the tree you were traversing. Example if you were traversing Explorer and for some unknown reason the search hung up, close the script and Explorer, preferably with Task Manager or PVIEW. The problem of the "grayed out" tree item is extremely rare but just in case... It is VERY, VERY IMPORTANT YOU REMEMBER THE ABOVE DESCRIBED RULE. **************************************************************************** Okay, now that we got the scary stuff out of the way... cSelectTVItem is an enhanced version of cSetTVItem. It was designed to be an easy to use, fast, tree search function. To use it you need the CDSWILEX.DLL Winbatch Extender and the CDSWILX2.DLL Search Engine. The syntax is as follows: cSelectTVItem( hwnd, {NULL | LONG}, {NULL | STRING}, {@TRUE | @FALSE} ) Each parameter must be supplied. The definitions of each parameter are in the help file. History. ======== It is successfully being used by my company, Centillion Data Systems, as a key part of our Automated Regression Testing Program, which is based on scripts developed using the WIL Programming Language. As our many applications, our commercial applications our employing tree controls as the interface of choice for application navigation. cSelectTVItem gives us the power to develop Winbatch scripts that easily navigate the tree controls in our software. We thought cSetTVItem would be the answer until we found out that Stingray Software was using it's own version of SysTreeView32. We needed Stingray because it permits multiple item selection and SysTreeView32 currently does not. For a moment it looked like we would be unable to develop our test scripts because WIL could not manipulate the Stingray tree! I quickly emailed Marty and he advised if an answer was to be found, the WIL SDK would be the place to start. The result of a month of coding and coffee was cSelectTVItem. At first we were glad it solved our immediate problem, but then we started using it in place of cSetTVItem. It handled tree issues so easily that it seemed like a good idea to post it on the WinBatch Technical Support Forum. Features ======== If you have one instance of cSetTVItem in your app or you were avoiding using cSetTVItem, (it can be demanding), you will quickly appreciate cSelectTVItem. When using it, several benefits quickly come to mind: 1. Returns the item name instead of a bool. This makes it possible to write code like: lookFor = "Winbatch" x = 1 while (x) itemName = cCSetTVItem(hwnd, x, "", @false) if stricmp(itemName,"") != 0 if (strIndexNc(itemName, lookFor, 0, @FWDSCAN)) message("","We can stop looking...") x = 0 else x = x + 1 endif else message("","End of the road, no match found!") x = 0 endif endWhile 2. Selections can be made by name or item number. You do not have to specify the tree path, nor does the tree have to be expanded. Next to the "string" return value, this is probably the most convenient feature of cSelectTVItem. 3. Can be used for non "SysTreeView32" tree controls. 4. Single or multiple selections can be made using this function. This feature is somewhat esoteric for now, but some non-SysTreeView32 controls do offer this capability. It may be in the works for SysTreeView32! 5. You do not need to de-select (cClearTVItem) an item. 6. It's fast! The examples in the help file will show you how to take advantage of this function. Hope this tides you over until Morrie and the gang do there thing. If, by some remote chance, it hiccups, email me, please. As stated earlier, this function plays an integral role in our software development schema and if there is something I overlooked I certainly would appreciate being made aware of it. dsadler@centilliondata.com If this program works, it was written by Derek Sadler. If not, I don't know who wrote it. cSelectTVItem, Copyright (c) 1999, Derek Sadler. All rights reserved.
TreeCtrl.zip
Article ID: W15399
File Created: 2017:08:29:11:33:20
Last Updated: 2017:08:29:11:33:20