Re: [win32lib] subclassing Combo's EditText

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

Thanks, Derek.

    Martin

----- Original Message ----- 
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: [win32lib] subclassing Combo's EditText


> Martin,
> win32lib has already done this for you. To get the id of the editbox
> belonging to a combo you can do something like this...
> 
>    sequence kids
>    integer edid
> 
>    kids = findChildren(mycombo)
>    for i = 1 to length(kids) do
>        if kids[i][2] = EditText then
>           edid = edid[i][1]
>           exit
>        end if
>    end for
> 
> Another method is this...
> 
>    edid = subClassControl( {EditText,id},
>                  w32Func(xGetWindow,{ geHandle(id), GW_CHILD}))
> 
> However, the reason that ChildWindowFromPoint didn't work is that definition
> of it in win32lib is wrong.
> The Microsoft C header is ...
> 
> HWND ChildWindowFromPoint(
>   HWND hWndParent,  // handle to parent window
>   POINT Point       // structure with point coordinates
> );
> 
> which looks like it has two parameters. However, the second parameter is a
> POINT structure; not a pointer to the structure, but the structure itself.
> The POINT structure is two longs. So then the proper win32lib definition
> should be ...
> 
>  ChildWindowFromPoint = registerw32Function( user32,
> "ChildWindowFromPoint",{ C_LONG, C_LONG, C_LONG }, C_LONG ),
> 
> Which means that a third method is this...
> 
>   edid = getId(w32Func(ChildWindowFromPoint, {getHandle(pComboBox), 1,1}))
> 
> This last one works because win32lib already subclasses the editbox and has
> thus already given it an id value.
> 
> 
> ----- Original Message -----
> From: "Martin Stachon" <martin.stachon at worldonline.cz>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, July 13, 2002 10:22 PM
> Subject: [win32lib] subclassing Combo's EditText
> 
> 
> > I need to set some handlers for EditText field of ComboBox.
> > I tried to subclass it according to this example from Microsoft:
> >
> > <c code>
> >     /* Get the edit window handle for each combo box. */
> >     pt.x = 1;
> >     pt.y = 1;
> >
> >     hwndEdit1 = ChildWindowFromPoint(hwndCombo1, pt);
> >     hwndEdit2 = ChildWindowFromPoint(hwndCombo2, pt);
> >
> >     /*
> >     * Change the window procedure for both edit windows
> >     * to the subclass procedure.
> >     */
> >
> >     lpfnEditWndProc = (WNDPROC) SetWindowLong(hwndEdit1,
> >         GWL_WNDPROC, (DWORD) SubClassProc);
> >
> >     SetWindowLong(hwndEdit2, GWL_WNDPROC,
> >         (DWORD) SubClassProc);
> > </c code>
> >
> > <eu code>
> >  -- subclass the edit control
> >  pt = acquire_mem( 0, SIZEOF_POINT )
> >  store(pt, ptX, 1) -- also tried [5,5];[10,10] etc.
> >  store(pt, ptY, 1)
> >  pComboBoxEdit = w32Func(ChildWindowFromPoint, {getHandle(pComboBox), pt})
> >  ? pComboBoxEdit
> >  release_mem(pt)
> >  pComboBoxEdit = subClassControl( {EditText, pWin}, pComboBoxEdit)
> >  ? pComboBoxEdit
> > </eu code>
> >
> > But the output is:
> > 0
> > 0
> > - this means that ChildWindowFromPoint failed. What I am doing wrong
> > or is there another way to get handle of the EditText?
> >
> > Regards,
> >       Martin Stachon
> >
> > martin.stachon at tiscali.cz
> > http://www.webpark.cz/stachon

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

Search



Quick Links

User menu

Not signed in.

Misc Menu