1. child windows not receiving focus events?

I'm writing an app that needs a child window to receive GotFocus/LostFocus
events. The problem is, the child window only receives an initial LostFocus
event. I'm using Win32Lib 0.60 and Windows XP Pro. I've attached a small
example. As you can see when running it, clicking or whatever does not
trigger a GotFocus on the child window, but clicking the EditText controls
does trigger the events. I know there's got to be a WS_ or WS_EX_ flag that
triggers this or something.

~Greg


begin 666 focus_demo.exw
M#0II;F-L=61E(%=I;C,R3&EB+F5W#0IW:71H;W5T('=A<FYI;F<-"@T*8V]N
M<W1A;G0-"@T*"4UA:6X)/2!C<F5A=&4H(%=I;F1O=RP@(D9O8W5S(%1E<W0B
M+" P+"!#96YT97(L($-E;G1E<BP@-# P+" S,# L(# @*2P-"@E497AT,0D]
M(&-R96%T92@@161I=%1E>'0L("(B+"!-86EN+"![=S,R161G92PQ,'TL('MW
M,S)%9&=E+#$P?2P@>S N-2PM-7TL(#(P+" P("DL#0H)5&5X=#()/2!C<F5A
M=&4H($5D:71497AT+" B(BP@36%I;BP@>S N-2PU?2P@>W<S,D5D9V4L,3!]
M+"![=S,R161G92PM,3!]+" R,"P@," I+ T*"5-U8E=I;@D](&-R96%T945X
M*"!7:6YD;W<L("(B+"!-86EN+"![=S,R161G92PQ,'TL('MW,S)%9&=E+#0P
M?2P@>W<S,D5D9V4L+3$P?2P@>W<S,D5D9V4L+3$P?2P-"@D)>U=37T-(24Q$
M+%=37U9)4TE"3$4L5U-?0TQ)4%-)0DQ)3D=3?2P@5U-?15A?0TQ)14Y4141'
M12 I#0H-"@T*#0IP<F]C961U<F4@1F]C=7-(86YD;&5R*"!I;G1E9V5R('!3
M96QF+"!I;G1E9V5R('!%=F5N="P@<V5Q=65N8V4@<%!A<F%M<R I#0H-"@EI
M9B!P4V5L9B ](%1E>'0Q('1H96X-"@D)<'5T<R@Q+" B5&5X=#$B*0T*"65L
M<VEF('!396QF(#T@5&5X=#(@=&AE;@T*"0EP=71S*#$L(")497AT,B(I#0H)
M96QS:68@<%-E;&8@/2!3=6)7:6X@=&AE;@T*"0EP=71S*#$L(")3=6)7:6XB
M*0T*"65N9"!I9@T*#0H):68@<$5V96YT(#T@=S,R2$=O=$9O8W5S('1H96X-
M"@D)<'5T<R@Q+" B($=O=$9O8W5S7&XB*0T*"65L<VEF('!%=F5N=" ]('<S
M,DA,;W-T1F]C=7,@=&AE;@T*"0EP=71S*#$L("(@3&]S=$9O8W5S7&XB*0T*
M"65N9"!I9@T*#0IE;F0@<')O8V5D=7)E#0IS971(86YD;&5R*"![5&5X=#$L
M5&5X=#(L4W5B5VEN?2P@>W<S,DA';W1&;V-U<RQW,S)(3&]S=$9O8W5S?2P@
M<F]U=&EN95]I9"@B1F]C=7-(86YD;&5R(BD@*0T*#0I7:6Y-86EN*"!-86EN
*+"!.;W)M86P@*0``
`
end

new topic     » topic index » view message » categorize

2. Re: child windows not receiving focus events?

Greg Haberek wrote:
 
> I'm writing an app that needs a child window to receive GotFocus/LostFocus
> events.

Windows (including child windows) can't receive those, if I understand
fully what Derek recently said about this issue.

> The problem is, the child window only receives an initial LostFocus
> event.

Is your app losing focus and you want to know when, or the window
itself?

> I'm using Win32Lib 0.60 and Windows XP Pro. I've attached a small
> example. As you can see when running it, clicking or whatever does not
> trigger a GotFocus on the child window, but clicking the EditText controls
> does trigger the events. I know there's got to be a WS_ or WS_EX_ flag that
> triggers this or something.
> 
> ~Greg

Couldn't make out the following... :)
 
> begin 666 focus_demo.exw
> M#0II;F-L=61E(%=I;C,R3&EB+F5W#0IW:71H;W5T('=A<FYI;F<-"@T*8V]N
> M<W1A;G0-"@T*"4UA:6X)/2!C<F5A=&4H(%=I;F1O=RP@(D9O8W5S(%1E<W0B
> M+" P+"!#96YT97(L($-E;G1E<BP@-# P+" S,# L(# @*2P-"@E497AT,0D]
> M(&-R96%T92@@161I=%1E>'0L("(B+"!-86EN+"![=S,R161G92PQ,'TL('MW
> M,S)%9&=E+#$P?2P@>S N-2PM-7TL(#(P+" P("DL#0H)5&5X=#()/2!C<F5A
> M=&4H($5D:71497AT+" B(BP@36%I;BP@>S N-2PU?2P@>W<S,D5D9V4L,3!]
> M+"![=S,R161G92PM,3!]+" R,"P@," I+ T*"5-U8E=I;@D](&-R96%T945X
> M*"!7:6YD;W<L("(B+"!-86EN+"![=S,R161G92PQ,'TL('MW,S)%9&=E+#0P
> M?2P@>W<S,D5D9V4L+3$P?2P@>W<S,D5D9V4L+3$P?2P-"@D)>U=37T-(24Q$
> M+%=37U9)4TE"3$4L5U-?0TQ)4%-)0DQ)3D=3?2P@5U-?15A?0TQ)14Y4141'
> M12 I#0H-"@T*#0IP<F]C961U<F4@1F]C=7-(86YD;&5R*"!I;G1E9V5R('!3
> M96QF+"!I;G1E9V5R('!%=F5N="P@<V5Q=65N8V4@<%!A<F%M<R I#0H-"@EI
> M9B!P4V5L9B ](%1E>'0Q('1H96X-"@D)<'5T<R@Q+" B5&5X=#$B*0T*"65L
> M<VEF('!396QF(#T@5&5X=#(@=&AE;@T*"0EP=71S*#$L(")497AT,B(I#0H)
> M96QS:68@<%-E;&8@/2!3=6)7:6X@=&AE;@T*"0EP=71S*#$L(")3=6)7:6XB
> M*0T*"65N9"!I9@T*#0H):68@<$5V96YT(#T@=S,R2$=O=$9O8W5S('1H96X-
> M"@D)<'5T<R@Q+" B($=O=$9O8W5S7&XB*0T*"65L<VEF('!%=F5N=" ]('<S
> M,DA,;W-T1F]C=7,@=&AE;@T*"0EP=71S*#$L("(@3&]S=$9O8W5S7&XB*0T*
> M"65N9"!I9@T*#0IE;F0@<')O8V5D=7)E#0IS971(86YD;&5R*"![5&5X=#$L
> M5&5X=#(L4W5B5VEN?2P@>W<S,DA';W1&;V-U<RQW,S)(3&]S=$9O8W5S?2P@
> M<F]U=&EN95]I9"@B1F]C=7-(86YD;&5R(BD@*0T*#0I7:6Y-86EN*"!-86EN
> *+"!.;W)M86P@*0``
> `
> end

-=ck
"Programming in a state of EUPHORIA."

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

3. Re: child windows not receiving focus events?

> Is your app losing focus and you want to know when, or the window
> itself?

I'm using Windows Caret routines and I need to create the Caret when I have
focus, and destroy the Caret when I lose focus. If I use a child window to
hold the Caret, then that window needs to receive GotFocus/LostFocus events.
I don't see why an EditText control can trigger these events, but a Window
can't. Aren't all other controls based off a basic child window?

> Couldn't make out the following... :)

Well that was supposed to be an attachment, but Outlook Express has been
acting really flakey lately. I think I'm going to start using Mozilla for my
web stuff.

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

4. Re: child windows not receiving focus events?

Greg Haberek wrote:
> 
> M#0II;F-L=61E(%=I;C,R3&EB+F5W#0IW:71H;W5T('=A<FYI;F<-"@T*8V]N
> M<W1A;G0-"@T*"4UA:6X)/2!C<F5A=&4H(%=I;F1O=RP@(D9O8W5S(%1E<W0B
> M+" P+"!#96YT97(L($-E;G1E<BP@-# P+" S,# L(# @*2P-"@E497AT,0D]
> M(&-R96%T92@@161I=%1E>'0L("(B+"!-86EN+"![=S,R161G92PQ,'TL('MW
......

Please don't post perl code to the Euphoria list.

Thank you.

Irv

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

5. Re: child windows not receiving focus events?

Nope, that didn't work. But I can't believe the solution didn't reach out of
the monitor and slap me in the face! All I did was test for any mouse event
except MouseMove and call setFocus() for the right window. I'm sure I could
test for some type of keyboard input, too.

procedure SetFocusHandler( integer pSelf, integer pEvent, sequence pParams )

    if pParams[1] != MouseMove then
        setFocus( pSelf )
    end if

end procedure
setHandler( MyWin, w32HMouse, routine_id("SetFocusHandler") )



----- Original Message -----
From: "Derek Parnell" <guest at RapidEuphoria.com>
To: <EUforum at topica.com>
Sent: Tuesday, July 13, 2004 4:08 PM
Subject: RE: child windows not receiving focus events?


>
>
> posted by: Derek Parnell <ddparnell at bigpond.com>
>
> Try these two patches in the win32lib to see if it helps..
>
> --- Patch #1 ---
> Find the routine "tab_direction()" and replace the lines ...
>
>     if  window_family[id] = WINDOW  or find(window_type[id],{ TabItem})
then
>         -- parent is self
>         parent = id
>
>
> with ...
>
>     if  find(window_type[id],{ TabItem}) then
>         -- parent is self
>         parent = id
>
>     elsif window_family[id] = WINDOW and window_owner[id] = 0 then
>         -- parent is self
>         parent = id
>
> --- Patch #2 ---
> In the routine createWindow(), replace the lines ...
>
>     if owner != 0 and  and_bits(WS_VISIBLE, lFlags) then
>         call_proc(r_openWindow, {id, Normal})
>     end if
>
>
> with ...
>
>     if owner != 0 then
>         if  and_bits(WS_VISIBLE, lFlags) then
>             call_proc(r_openWindow, {id, Normal})
>         end if
>
>         if and_bits( WS_TABSTOP, lFlags ) then
>             -- add to the owner's focus_order list
>             window_focus_order[owner] &= id
>         end if
>
>     end if
>
>
> Then all you have to do is create your child window with the
> WS_TABSTOP flag included.
>
> --
> Derek Parnell
> Melbourne, Australia
>
>
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu