Finding a control type from an ID
- Posted by Derek Parnell <dparnell at BIGPOND.NET.AU> Nov 18, 2000
- 397 views
Hi, recently somebody wanted to find out the control type given a control id. I thought that we couldn't do this yet in win32lib, but I've been reminded (thanks Travis) that the findChildren() function could be used. This function returns a list of subsequences, one for each control owned by a given control. The subsequence contains two elements - the control id, and the control type. For example... sequence children -- Get a list of all the controls owned by this window children = findChildren(myWin) -- Set the caption for each of the PushButtons. for i = 1 to length(children) do if find(children[i][2],{PushButton,DefPushButton}) then setText(children[i][1], sprintf("Button%d", i)) end if end for ------ Derek Parnell Melbourne, Australia (Vote [1] The Cheshire Cat for Internet Mascot)