[ wxwindows-Patches-1836072 ] Center wxMessageBox on parent
SourceForge.net
noreply at sourceforge.net
Sat Dec 1 11:06:49 PST 2007
Patches item #1836072, was opened at 2007-11-21 22:12
Message generated for change (Comment added) made by troelsk
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1836072&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: MSW specific
Group: None
Status: Open
Resolution: None
Priority: 4
Private: No
Submitted By: troelsk (troelsk)
Assigned to: Vadim Zeitlin (vadz)
Summary: Center wxMessageBox on parent
Initial Comment:
The MSW wxMessageBox is always centered on the screen, ignoring wxCENTER and wxCENTRE_ON_SCREEN flags.
Patch:
- Center wxMessageBox on parent if wxCENTER specified (wxCENTER is a wxMessageBox default parameter)
----------------------------------------------------------------------
>Comment By: troelsk (troelsk)
Date: 2007-12-01 20:06
Message:
Logged In: YES
user_id=1290727
Originator: YES
One way to avoid all this would be to drop the MessageBox API call
altogether, and make wxMessageDialog a true wxDialog. This would probably
make it look less native - but it would enable customisation, such as
adding checkmarks for "Don't show this dialog again" or "Apply to all"
etc.
----------------------------------------------------------------------
Comment By: troelsk (troelsk)
Date: 2007-11-28 20:16
Message:
Logged In: YES
user_id=1290727
Originator: YES
>HCBT_ACTIVATE is normally for WH_CBT hooks only,
>how comes you get it in a WH_CALLWNDPROCRET hook?
Good question. Indeed, I don't see HCBT_ACTIVATE documented in a
WH_CALLWNDPROCRET context. I lifted the code from here:
http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic411.aspx
I chose this instead of the MFC way of doing it because it's simpler (MFC
uses a WH_CBT hook plus a wndproc hook, here I use only a WH_CALLWNDPROCRET
hook).
I'd say apply it as is, if it turns out to work for everybody there is no
reason to make it more complicated (than necessary). Seen to work on
WinXP/Vista/95 *)
>I also wonder why do you assume that all messages
>passed to the hook are for the message box
It's *almost* fair to assume that no other window creation/activation are
taking place in the same one thread, as MessageBox blocks the UI
interaction.
Only problem could be if a timer event, or an external event, brings up
another MessageBox, or another window.
>implement wxMessageBox::Move() too...it could be done in a separate
patch
A logical next step indeed.
>better to use wxTLS class, the only problem is that I still
>haven't checked it in...
New to me, looking forward to see it...perhaps applied here in
wxMessageDialog?
*)
https://sourceforge.net/tracker/index.php?func=detail&aid=1840492&group_id=9863&atid=359863
Added new revision, center-messagebox2.patch:
Changed LPARAM/WPARAM/CALLBACK to WXLPARAM/WXWPARAM/wxCALLBACK.
File Added: center-messagebox2.patch
----------------------------------------------------------------------
Comment By: Vadim Zeitlin (vadz)
Date: 2007-11-28 03:33
Message:
Logged In: YES
user_id=71618
Originator: NO
Interesting, thanks. But I don't understand how it works to be honest:
HCBT_ACTIVATE is normally for WH_CBT hooks only, how comes you get it in a
WH_CALLWNDPROCRET hook? I also wonder why do you assume that all messages
passed to the hook are for the message box, couldn't we get other messages
while the message box is shown?
Also, I wonder if we shouldn't implement wxMessageBox::Move() too if we
can make Centre() work. Of course, it could be done in a separate patch.
Finally, I think using a map like this is a bit clumsy, it would have been
really better to use wxTLS class, the only problem is that I still haven't
checked it in...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1836072&group_id=9863
More information about the wx-dev
mailing list