wxMessageBox always show a title bar icon

88 views
Skip to first unread message

LIANG ZHOU

unread,
Nov 23, 2020, 9:35:49 AM11/23/20
to wx-users
E9C0805C-D67C-4C4F-8B4C-EA25240C851F.jpeg
Hi all,
I have an app which stays in the system tray and has a hidden main window. Sometimes I need to show a message box to users with some info, but the title bar of the message box always show a small info icon. I tried to set the main window icon, as well as use wxMessageDialog instead and call SetIcon before ShowModal, but neither of them works. By searching the source code, I didn't find the code setting this icon. BTW, I'm using the latest stable version of wx. Anybody know the reason? Thanks!


LIANG ZHOU

unread,
Nov 24, 2020, 10:32:36 PM11/24/20
to wx-users
Using the native MessageBox API doesn't have this issue. 


Vadim Zeitlin

unread,
Nov 25, 2020, 12:08:52 PM11/25/20
to wx-u...@googlegroups.com
On Mon, 23 Nov 2020 06:35:49 -0800 (PST) LIANG ZHOU wrote:

LZ> I have an app which stays in the system tray and has a hidden main window.
LZ> Sometimes I need to show a message box to users with some info, but the
LZ> title bar of the message box always show a small info icon.

What would you like it to do instead? Some other icon or no icon at all?

LZ> I tried to set the main window icon, as well as use wxMessageDialog
LZ> instead and call SetIcon before ShowModal, but neither of them works.

Yes, SetIcon() indeed doesn't work for the native dialogs.

On Tue, 24 Nov 2020 19:32:36 -0800 (PST) LIANG ZHOU wrote:

LZ> Using the native MessageBox API doesn't have this issue.

wxMessageDialog uses task dialog, rather than the classic message box
function, on all Windows versions still in use (Vista+).

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Message has been deleted

LIANG ZHOU

unread,
Nov 27, 2020, 3:09:49 AM11/27/20
to wx-users
Hi,
Showing both a big information icon in the message and a small icon in the title bar looks very strange. 
Windows Vista for Developers – Part 2 – Task Dialogs in Depth
From this article, the TDF_CAN_BE_MINIMIZED  flag  seems to be related to the title bar icon. 
BTW, I still don't understand why wxMessageBox doesn''t show a title bar icon most of the time, but occationally fails to do that.   

Leo
回复全部
回复作者
转发

Vadim Zeitlin

unread,
Nov 27, 2020, 8:49:18 AM11/27/20
to wx-u...@googlegroups.com
On Fri, 27 Nov 2020 00:06:34 -0800 (PST) LIANG ZHOU wrote:

LZ> Showing both a big information icon in the message and a small icon in the
LZ> title bar looks very strange.

I understand that you find it strange and wrong. I still don't understand
why. I've tried asking you a question about what would you like to happen
instead, in the hope of understanding better what the perceived problem is,
but you've simply ignored it. I'm sorry, but I feel like I've done as much
effort as I could to try to understand your problem and I'll just give up
now.

LZ> Windows Vista for Developers – Part 2 – Task Dialogs in Depth
LZ> <https://weblogs.asp.net/kennykerr/Windows-Vista-for-Developers-_1320_-Part-2-_1320_-Task-Dialogs-in-Depth>
LZ> From this article, the TDF_CAN_BE_MINIMIZED flag seems to be related to
LZ> the title bar icon.

Whatever the problem is, we're not going to make the dialog iconizable
just to deal with the icon.

LZ> BTW, I still don't understand why wxMessageBox doesn''t show a title bar
LZ> icon most of the time but occationally.

Please explain what do you mean, i.e. give the examples of what you're
speaking about. Just in case I was unclear above, let me repeat: something
which is obvious to you is not necessarily obvious for the others. In this
particular case I simply have no idea at all about do you mean and what the
real problem is. You need to make an effort to try to explain it better to
increase the probability of the problem being actually fixed.
Message has been deleted

LIANG ZHOU

unread,
Nov 30, 2020, 9:20:08 PM11/30/20
to wx-users
Sorry for the unclear statements. In my option, a message box should not show any title bar icon in any circumstance, unless it is told to do that. I never run into this problem when using the native system API, both on Windows and macOS.
I'm not sure how wxMessagebox is implemented under the hood, but it should be consistent with system default behaviour.

My app is a system tray one with a hidden main window. When users click a context menu item from the system tray icon,  i need to show a info message box sometimes. When the message box is shown from the main hidden window,  it always show a small info icon on the title bar. But this problem never happens when it's shown from non-main windows. Thanks!

Leo

Vadim Zeitlin

unread,
Dec 1, 2020, 4:15:11 PM12/1/20
to wx-u...@googlegroups.com
On Mon, 30 Nov 2020 18:20:08 -0800 (PST) LIANG ZHOU wrote:

LZ> Sorry for the unclear statements. In my option, a message box should not
LZ> show any title bar icon in any circumstance, unless it is told to do that.
LZ> I never run into this problem when using the native system API, both on
LZ> Windows and macOS.

I'm almost certain that the icon is selected automatically by the system
depending on the parent window, i.e. you should see exactly the same
behaviour if you use task dialog directly from Win32 API.

LZ> My app is a system tray one with a hidden main window. When users click a
LZ> context menu item from the system tray icon, i need to show a info message
LZ> box sometimes. When the message box is shown from the main hidden window,
LZ> it always show a small info icon on the title bar. But this problem never
LZ> happens when it's shown from non-main windows. Thanks!

You should probably be able to give your message box a non-main window as
parent (if necessary creating a dummy hidden window just for it, I guess).
But I honestly thought the problem was something more serious, e.g. showing
a wrong icon or not showing the expected icon. IMHO showing the icon in the
title bar is really not a big deal and it seems perfectly normal to me,
this is what all normal windows do and many dialogs (e.g. "File open") do
this too.
Reply all
Reply to author
Forward
0 new messages