1. Win32Lib dynamic controls

While working on eWinHelp, I found a need to create and destroy controls =
in the middle of the program.  Following is the code for creating =
controls dynamically, although I haven't had a chance to write the =
destruction procedure yet.  I apologize to David Cuny for modifying =
Win32Lib slightly as noted in the comments.  The code is about 55 lines =
long.

------ Tested code -------

-- Dynactrl.ew
-- Dynamic control module for Win32Lib.
-- Append to the END of Win32Lib or make the following variable/routine =
names
-- global:

-- Line 1182 of alpha-10: global sequence className, classType, ...
-- Line 1420 of alpha-10: global atom WndProcAddress
-- Line 1621 of alpha-10: global atom buffer1, buffer2
-- Line 1682 of alpha-10: global sequence window, window_handle, =
window_func,...

-- Written by Michael J. Sabal on August 27, 1998

global function addControl(integer typeOf, sequence title, atom owner,
    atom x, atom y, atom xSize, atom ySize, atom styleFlags)

    atom ctrlID
   =20
    window =3D append(window,
        {owner,typeOf,title,x,y,xSize,ySize,styleFlags})
    ctrlID =3D length(window)

    poke(buffer1,className[typeOf]&0)
    poke(buffer2,title&0)
    styleFlags =3D or_bits(classStyle[typeOf],styleFlags)
   =20
    window_handle =3D append(window_handle, c_func(xCreateWindow, {
            0,
            buffer1,
            buffer2,
            styleFlags,
            x,
            y,
            xSize,
            ySize,
            window_handle[owner],
            NULL,
            0,
            NULL}))
    window_func =3D append(window_func, c_func(xSetWindowLong,
        {window_handle[ctrlID],GWL_WndProc,WndProcAddress}))
    window_class =3D append(window_class, classType[typeOf])
    if and_bits(WS_TABSTOP,styleFlags) then
      window_tab[owner] =3D append(window_tab[owner],ctrlID)
    end if
    window_owner =3D append(window_owner, owner)
   =20
    return ctrlID

end function

---------------------

Michael J. Sabal
mjs at osa.att.ne.jp
http://home.att.ne.jp/gold/mjs/index.html

new topic     » topic index » view message » categorize

2. Re: Win32Lib dynamic controls

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BDD1F0.9CF9626C
        charset="iso-8859-1"

[Michael Sabal posted some dynamic control creation code for Win32Lib]

Thanks. I'll look into changing the code. There are various reasons why I
allocate at the beginning of the program, but it was meant only to be a
temporary stopgap.

-- David Cuny

------_=_NextPart_001_01BDD1F0.9CF9626C
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2232.0">
<TITLE>RE: Win32Lib dynamic controls</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>[Michael Sabal posted some dynamic control creation =
code for Win32Lib]</FONT>
</P>

<P><FONT SIZE=3D2>Thanks. I'll look into changing the code. There are =
various reasons why I allocate at the beginning of the program, but it =
was meant only to be a temporary stopgap.</FONT></P>

<P><FONT SIZE=3D2>-- David Cuny</FONT>
</P>

</HTML>
------_=_NextPart_001_01BDD1F0.9CF9626C--

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu