Re: Windows API

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

David Foulds wrote:

> Does that mean that I could get access to the hWnd handle
> of a window created with the win32lib create() function, so
> as to add other controls?

You can get a handle using getHandle(), but if you created other controls
with something other than create(), you couldn't use Win32Lib's routines on
them, since it wouldn't have the data structure set up correctly.

At one point I was considering extending Win32Lib so that it would be
relatively easy to add new classes of controls. But in theory that's the
point of Llama. If there's demand for it, I could add a new create command
along these lines:

   createClass( class, className, name, parent, x, y, cx, cy, flags )

For example:

   createClass( BUTTON, "button", "My Button", TheWindow, 10, 10, 40, 30,
        { WS_CHILD, WS_VISIBLE, WS_AUTOCHECKBOX, WS_TABSTOP } )

would create a checkbox button, or:

    createClass( STATUSCLASSNAMEA, COMMON_CONTROL, 0, 0, 500, 32,
        { WS_CHILD, WS_VISIBLE, WS_CLIPSIBLINGS, CCS_BOTTOM } )

would create a status bar. You would still need to trap all the events
manually for the specialized controls, but at least you would have access to
the default routines that Win32Lib provides.

The actual implementation of createClass would be trivial: I could just
create a dummy class TempClass that would hold values. createClass would
initialize the class to the values, and then create the object using that
class:

    global function createClass( ... )

        -- set up the class
        className[ TempClass ] = theClassName
        classType[ TempClass ] = theClassType
        classStyle[ TempClass ] or_all( theStyleFlags )

        -- create an object of the new class
        return create( TempClass ... )

    end function

The create() function would have to be slightly tweaked as well, to work
properly with Windows.

My feeling is that I need to get Llama/Win32 released Real Soon Now instead,
so it's done properly instead of with a hack.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu