I plan to make a skinned version of wxMessageBox. I wonder about some aspects:
- Should a class to do that be a good idea (since wxMessageBox is a function)?
- If so, which should be the best base class to derive?
- How to get the modal behavior?
Many thanks for any suggestion,
Pascal
Question about skinned wxMessageBox
Re: Question about skinned wxMessageBox
Create a class and add another global function that wraps creating/showing the dialog.- Should a class to do that be a good idea (since wxMessageBox is a function)?
wxDialog, maybe wxMessageDialog.- If so, which should be the best base class to derive?
- How to get the modal behavior?
Use the source, Luke!
Re: Question about skinned wxMessageBox
Great, I'll get right on it. Thanks!
Re: Question about skinned wxMessageBox
But I still have troubles with automatically centering the message box on the app frame:
Calling myMessageBox (my function that replaces wxMessageBox) does not mention the parent window.
On the other hand, I didn't manage to access the top level window from my MyMessageDialog.
Re: Question about skinned wxMessageBox
The "original" wxMessageBox has a "parent" parameter.Calling myMessageBox (my function that replaces wxMessageBox) does not mention the parent window.
On the other hand, I didn't manage to access the top level window from my MyMessageDialog.
http://docs.wxwidgets.org/trunk/group__ ... 42de252647
You could use wxTheApp->GetTopWindow(), but i would consider it a bit "dirty". It's also not 100% reliable, as the "top" window is not necessarily the one myMessageBox was called from.
Use the source, Luke!
Re: Question about skinned wxMessageBox
Thanks for your advice that offers a solution but that doesn't fully answer my expectation:
Actually, until now I'm used to call wxMessageBox like this:
wxMessageBox(_("bla bla")), i.e, with just one parameter
and the message box is always well centered.
I'd like to keep on doing the same with myMessageBox, without the need to pass its
parent as a parameter...
Best regards,
Pascal
Actually, until now I'm used to call wxMessageBox like this:
wxMessageBox(_("bla bla")), i.e, with just one parameter
and the message box is always well centered.
I'd like to keep on doing the same with myMessageBox, without the need to pass its
parent as a parameter...
Best regards,
Pascal
Re: Question about skinned wxMessageBox
wxMessageBox uses this to find a parent:
Code: Select all
wxWindow *wxDialogBase::GetParentForModalDialog() const
Use the source, Luke!
Re: Question about skinned wxMessageBox
Wow! I missed that (but you didn't!).
Only 2 lines to change and it works great!
Doublemax, you're the best and saved my evening.
I am very grateful for your valuable help.
Have a very good weekend!
Pascal
Only 2 lines to change and it works great!
Doublemax, you're the best and saved my evening.
I am very grateful for your valuable help.
Have a very good weekend!
Pascal