Finding a control type from an ID

new topic     » topic index » view thread      » older message » newer message

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)

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu