how to detect why I got the focus
Harry
"harry dot news at armadillo dot fr" at a.mx.sunsite.dk
Tue Dec 4 14:05:04 PST 2007
From the doc of WM_MOUSEACTIVE:
lParam : The low-order word specifies the hit-test value returned by the =
DefWindowProc function as a result of processing the WM_NCHITTEST message.
(This will return values such as HTTOP and HTRIGHT, meaning a click in =
the corresponding non-client area.)
As a simplified example (my case is much more complex), take two frames =
where an action is required in frame 1
but the user clicks in frame2 - I would then like to re-activate frame =
1. However, if the user is resizing frame 2,
then I can't return the focus to frame 1 until after the resize is done =
(otherwise frame 2 becomes un-resizeable).
In other words, I would like to block an activate, but not a resize.
I haven't found in wxWidgets any way of exercising such fine control =
over the user interface.
Harry
Chris Mellon wrote:
I'm not sure why you think that catching WM_MOUSEACTIVE is any sort of
indication of the users intention.
Note that on some platforms, frames themselves can't even have the focus.
Also note that a click in the non-client area (such as the resize
border) doesn't remove focus from a child window.
Finally, if you make a panel the only child of your frame, and have
all your other controls (as is recommended behavior in general) the
focus handling in wx.Panel will prevent it from taking focus if there
are any child windows that can have it, and will give the behavior you
seem to be interested in.
---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
On Dec 4, 2007 8:59 AM, dot news at armadillo dot fr"@a.mx.sunsite.dk
> Harry <"harry> wrote:
> =
>> Chris,
>>
>> wxActivateEvent contains only the information that my application or
>> window got/lost the focus, not why/where.
>> I've searched the source of wxWidgets, without finding any code that
>> deals with the why/where.
>> I still hope that I've missed out on some simple solution.
>>
>> Harry
>>
>>
>> chris elliott wrote:
>> =
>>> you need to handle a wxActivateEvent
>>>
>>> see
>>> http://biolpc22.york.ac.uk/wx/docs/html/wx/wx_wxactivateevent.html#wxac=
tivateevent
>>>
>>>
>>> chris
>>>
>>> Harry wrote:
>>> =
>>>> I need to detect why my frame has received the focus.
>>>> The reason for this is that I have quite a complicated constellation
>>>> of windows positioned within the frame.
>>>> If the user clicks by mistake inside the frame, I would like to
>>>> return the focus to his last window.
>>>> If the user clicks the frame by intention, for example to resize it,
>>>> I would like to let him do so without interference,
>>>> process the resize event, and only afterwards return the focus to his
>>>> last window.
>>>>
>>>> Under MSW I would process the WM_MOUSEACTIVATE message before getting
>>>> the focus to find out the reason why.
>>>> However, I haven't found any such mechanism in wxWidgets that allows
>>>> me this functionality.
>>>>
>>>> Anyone has any idea how I might detect why I got the focus in a
>>>> portable way ?
>>>>
>>>>
>>>> =
>
> =
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20071204/d00=
03102/attachment.htm
More information about the wx-users
mailing list